watch: escape quotes and backslashes in NODE_OPTIONS · nodejs/node@41e9ab9 · GitHub
Skip to content

Commit 41e9ab9

Browse files
trivikraduh95
authored andcommitted
watch: escape quotes and backslashes in NODE_OPTIONS
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>
1 parent bec7c53 commit 41e9ab9

2 files changed

Lines changed: 43 additions & 4 deletions

File tree

‎lib/internal/main/watch_mode.js‎

Lines changed: 14 additions & 4 deletions

‎test/sequential/test-watch-mode.mjs‎

Lines changed: 29 additions & 0 deletions

0 commit comments

Comments
 (0)