Skip to content

watch: escape quotes and backslashes in NODE_OPTIONS - #66363

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:watch-quotes-backslashes
Open

trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:watch-quotes-backslashes

Conversation

@trivikr

@trivikr trivikr commented Sep 28, 2026

Copy link
Copy Markdown
Member

Fixes: #66362

When stripping watch flags, NODE_OPTIONS is tokenized and rejoined for the child process. Values were only re-quoted if they contained a space, and nothing inside the quotes was escaped. A value with a double quote made the child fail with "unterminated string", and a backslash inside a quoted value was silently dropped.

Quote values that contain a space or a double quote, and escape backslashes and double quotes inside the quotes, so the child tokenizes the string back to the same values.


Assisted-by: claude:opus-5.5

When stripping watch flags, NODE_OPTIONS is tokenized and rejoined
for the child process. Values were only re-quoted if they contained
a space, and nothing inside the quotes was escaped. A value with a
double quote made the child fail with "unterminated string", and a
backslash inside a quoted value was silently dropped.

Quote values that contain a space or a double quote, and escape
backslashes and double quotes inside the quotes, so the child
tokenizes the string back to the same values.

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 (c177786).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66363      +/-   ##
==========================================
- Coverage   90.36%   90.35%   -0.02%     
==========================================
  Files         792      792              
  Lines      275398   275398              
  Branches    52776    52782       +6     
==========================================
- Hits       248877   248826      -51     
- Misses      16937    16987      +50     
- Partials     9584     9585       +1     

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

@trivikr trivikr added watch-mode Issues and PRs related to watch mode. author ready PRs with CI started, the required approvals, and no outstanding review comments. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 28, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 28, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

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

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. 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.

watch: reconstructing NODE_OPTIONS for the child process corrupts quotes and backslashes

3 participants