watch: escape quotes and backslashes in NODE_OPTIONS by trivikr · Pull Request #66363 · nodejs/node · GitHub
Skip to content

watch: escape quotes and backslashes in NODE_OPTIONS - #66363

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
trivikr:watch-quotes-backslashes
Oct 5, 2026
Merged

nodejs-github-bot merged 2 commits 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

@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

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr

trivikr commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

@MoLow I'd to push a fixup commit in c7b6953 to skip SunOS, since it has empty process.title

Can you please approve the PR again?

@trivikr trivikr removed the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 29, 2026
@MoLow MoLow added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Sep 29, 2026
@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. commit-queue PRs queued for automated landing through the Commit Queue. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 30, 2026
@nodejs-github-bot nodejs-github-bot added the lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. label Sep 30, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 85df70e into nodejs:main Oct 5, 2026
80 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot nodejs-github-bot removed commit-queue PRs queued for automated landing through the Commit Queue. lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. labels Oct 5, 2026
aduh95 pushed a commit that referenced this pull request Oct 5, 2026
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
PR-URL: #66363
Fixes: #66362
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
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