Title: watch: reconstructing NODE_OPTIONS for the child process corrupts quotes and backslashes · Issue #66362 · nodejs/node · GitHub
Open Graph Title: watch: reconstructing NODE_OPTIONS for the child process corrupts quotes and backslashes · Issue #66362 · nodejs/node
X Title: watch: reconstructing NODE_OPTIONS for the child process corrupts quotes and backslashes · Issue #66362 · nodejs/node
Description: Version main Platform All Subsystem watch What steps will reproduce the bug? $ mkdir watch-repro && cd watch-repro $ printf 'console.log(JSON.stringify(process.title));\n' > app.cjs Case 1: a value containing a double quote makes the chi...
Open Graph Description: Version main Platform All Subsystem watch What steps will reproduce the bug? $ mkdir watch-repro && cd watch-repro $ printf 'console.log(JSON.stringify(process.title));\n' > app.cjs Case 1: a value...
X Description: Version main Platform All Subsystem watch What steps will reproduce the bug? $ mkdir watch-repro && cd watch-repro $ printf 'console.log(JSON.stringify(process.title));\n' > app....
Opengraph URL: https://github.com/nodejs/node/issues/66362
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"watch: reconstructing NODE_OPTIONS for the child process corrupts quotes and backslashes","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nAll\n```\n\n### Subsystem\n\nwatch\n\n### What steps will reproduce the bug?\n\n```console\n$ mkdir watch-repro && cd watch-repro\n$ printf 'console.log(JSON.stringify(process.title));\\n' > app.cjs\n```\n\n**Case 1: a value containing a double quote makes the child fail to start**\n\n```console\n$ NODE_OPTIONS='--title=\"a\\\"b\"' node app.cjs\n\"a\\\"b\"\n\n$ NODE_OPTIONS='--title=\"a\\\"b\"' node --watch app.cjs\n/path/to/node: invalid value for NODE_OPTIONS (unterminated string)\n\nFailed running 'app.cjs'. Waiting for file changes before restarting...\n```\n\n**Case 2: a value containing a backslash is silently altered**\n\n```console\n$ NODE_OPTIONS='--title=\"a \\\\b\"' node app.cjs\n\"a \\\\b\"\n\n$ NODE_OPTIONS='--title=\"a \\\\b\"' node --watch app.cjs\n\"a b\"\nCompleted running 'app.cjs'. Waiting for file changes before restarting...\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe reconstructed `NODE_OPTIONS` string must tokenize back to exactly the tokens that were parsed, so the child process observes the same options as a non-`--watch` run. Round-tripping through the tokenizer is lossless only if the serializer is the exact inverse of it, which means escaping the characters the tokenizer treats specially.\n\n### What do you see instead?\n\nThe child either refuses to start with `invalid value for NODE_OPTIONS (unterminated string)`, or starts with a silently wrong option value (`a \\b` becomes `a b`).\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-09-28T00:31:18Z","url":"https://github.com/nodejs/node/issues/66362"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:19087cee-b79c-d51b-dddd-a00633e35d80 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DAC2:32C11E:54BE8C:734F82:6AED5BC5 |
| html-safe-nonce | 64bf05d60df2b5acfc22afff2e0380d2fb95562dcdd9c35362850d0f63e68ded |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQUMyOjMyQzExRTo1NEJFOEM6NzM0RjgyOjZBRUQ1QkM1IiwidmlzaXRvcl9pZCI6IjYxODg4OTg0NzkxODc1MTYzNTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | d1ac058fb69026702a4d90cad0fd6777c84493b07db670dbf14ea8863b0bc5db |
| hovercard-subject-tag | issue:5607632639 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66362/issue_layout |
| twitter:image | https://opengraph.githubassets.com/51f0d635b2f92eeaec29cf5cd9a2378da23b2b7c51debc1aaf9550f24e9ed08b/nodejs/node/issues/66362 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/51f0d635b2f92eeaec29cf5cd9a2378da23b2b7c51debc1aaf9550f24e9ed08b/nodejs/node/issues/66362 |
| og:image:alt | Version main Platform All Subsystem watch What steps will reproduce the bug? $ mkdir watch-repro && cd watch-repro $ printf 'console.log(JSON.stringify(process.title));\n' > app.cjs Case 1: a value... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width