Skip to content

watch: fix --env-file-if-exists crashing on linux if the file is missing#61870

Open
efekrskl wants to merge 9 commits intonodejs:mainfrom
efekrskl:fix/watch-mode-optional-env-crash
Open

watch: fix --env-file-if-exists crashing on linux if the file is missing#61870
efekrskl wants to merge 9 commits intonodejs:mainfrom
efekrskl:fix/watch-mode-optional-env-crash

Conversation

@efekrskl
Copy link
Contributor

Fixes #57040

--env-file-if-exists combined with --watch seems to crash in if the .env file is missing (in Linux), this PR aims to fix that.

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Feb 17, 2026
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

❌ Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.66%. Comparing base (4f13746) to head (7feebe6).
⚠️ Report is 165 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/fs/recursive_watch.js 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #61870      +/-   ##
==========================================
- Coverage   89.72%   89.66%   -0.06%     
==========================================
  Files         675      676       +1     
  Lines      204806   206347    +1541     
  Branches    39355    39534     +179     
==========================================
+ Hits       183761   185021    +1260     
- Misses      13330    13458     +128     
- Partials     7715     7868     +153     
Files with missing lines Coverage Δ
lib/fs.js 98.19% <100.00%> (+<0.01%) ⬆️
lib/internal/fs/watchers.js 88.03% <100.00%> (+0.73%) ⬆️
lib/internal/watch_mode/files_watcher.js 90.69% <100.00%> (+0.08%) ⬆️
lib/internal/fs/recursive_watch.js 85.27% <88.88%> (+0.36%) ⬆️

... and 181 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Renegade334 Renegade334 added the watch-mode Issues and PRs related to watch mode label Feb 18, 2026
@efekrskl efekrskl requested a review from aduh95 February 18, 2026 19:06
@efekrskl
Copy link
Contributor Author

@anonrig I've addressed all comments. I've also documented the change in fs.watch options and added some tests, I'm guessing this would be required as it is public facing.

Also, thanks a lot for the quick and detailed feedback!

@efekrskl efekrskl requested a review from anonrig February 19, 2026 22:33
@efekrskl efekrskl requested a review from aduh95 March 4, 2026 18:17
@anonrig anonrig added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Mar 10, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 10, 2026
@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. watch-mode Issues and PRs related to watch mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--env-file-if-exists throws error when the .env file doesn't exist and when combined with --watch (now in lts)

5 participants