Skip to content

watch: strip underscore aliases of watch flags - #66365

Open
trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:watch-underscore-aliases
Open

trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:watch-underscore-aliases

Conversation

@trivikr

@trivikr trivikr commented Sep 28, 2026

Copy link
Copy Markdown
Member

Fixes: #66364

The C++ option parser treats _ and - as the same character in option names, so --watch_path is the same as --watch-path.

Watch mode compared spellings literally when it removed its own flags from process.execArgv and NODE_OPTIONS before spawning the child. The underscore spellings got through, so each child went back into watch mode and spawned another child, and the application never ran.

Normalize option names before comparing them. Forward the original arguments to the child unchanged.


Assisted-by: claude:opus-5.5

The C++ option parser treats `_` and `-` as the same character in
option names, so `--watch_path` is the same as `--watch-path`.

Watch mode compared spellings literally when it removed its own flags
from `process.execArgv` and `NODE_OPTIONS` before spawning the child.
The underscore spellings got through, so each child went back into
watch mode and spawned another child, and the application never ran.

Normalize option names before comparing them. Forward the original
arguments to the child unchanged.

Signed-off-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
Assisted-by: claude:opus-5.5
@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Sep 28, 2026
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.35%. Comparing base (75e4bbe) to head (3ef07c5).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66365      +/-   ##
==========================================
- Coverage   90.36%   90.35%   -0.02%     
==========================================
  Files         792      792              
  Lines      275398   275424      +26     
  Branches    52776    52779       +3     
==========================================
- Hits       248877   248861      -16     
- Misses      16937    16982      +45     
+ Partials     9584     9581       -3     

see 32 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.

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

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

watch: NODE_OPTIONS filter misses underscore aliases like --watch_path, causing recursive spawning

2 participants