Title: `SIGTERM` killing an invalid `node:child_process` spawn terminates main process · Issue #65052 · nodejs/node · GitHub
Open Graph Title: `SIGTERM` killing an invalid `node:child_process` spawn terminates main process · Issue #65052 · nodejs/node
X Title: `SIGTERM` killing an invalid `node:child_process` spawn terminates main process · Issue #65052 · nodejs/node
Description: TipRewritten by @avivkeller Version v24.19.0, v26.6.0 Platform macOS Darwin Subsystem node:child_process What steps will reproduce the bug? Running .kill('SIGTERM') on an invalid child_process spawn results in the termination of the main...
Open Graph Description: TipRewritten by @avivkeller Version v24.19.0, v26.6.0 Platform macOS Darwin Subsystem node:child_process What steps will reproduce the bug? Running .kill('SIGTERM') on an invalid child_process spaw...
X Description: TipRewritten by @avivkeller Version v24.19.0, v26.6.0 Platform macOS Darwin Subsystem node:child_process What steps will reproduce the bug? Running .kill('SIGTERM') on an invalid child_proc...
Opengraph URL: https://github.com/nodejs/node/issues/65052
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`SIGTERM` killing an invalid `node:child_process` spawn terminates main process","articleBody":"> [!TIP]\n> Rewritten by @avivkeller\n\n### Version\n\nv24.19.0, v26.6.0\n\n### Platform\n\n```text\nmacOS Darwin\n```\n\n### Subsystem\n\n`node:child_process`\n\n### What steps will reproduce the bug?\n\nRunning `.kill('SIGTERM')` on an invalid `child_process` spawn results in the termination of the main Node.js process (the caller)\n\nFor instance, running `require('child_process').spawn('whoami').kill('SIGTERM');`.\n\n### How often does it reproduce? Is there a required condition?\n\nEvery time.\n\n### What is the expected behavior? Why is that the expected behavior?\n\nNode.js should abort killing since `.pid` will be `0`.\n\n\u003cdetails>\n\u003csummary>Original Issue\u003c/summary>\n\n### Version\n\nv24.18.0\n\n### Platform\n\n```text\nmacOS Darwin\n```\n\n### Subsystem\n\n_No response_\n\n### What steps will reproduce the bug?\n\nHi, \n\nI would like to report a bug that happens only on macOS. When run the code snippet below, the main process gets terminated: \n\n```javascript\nvar {spawn} = require('child_process');\n\nArray.prototype[Symbol.iterator] = function* () {};\nvar proc = spawn(\"ts-node\", [\"--version\"]); //or any other non-OS native command, e.g., brew --version \nconsole.log(\"subprocess forked\");\nproc.kill('SIGTERM');\nconsole.log(\"Killed Subprocess\");\n```\n\n### How often does it reproduce? Is there a required condition?\n\nIt's a permanent effect \n\n### What is the expected behavior? Why is that the expected behavior?\n\nTo kill the child process only \n\n\n### What do you see instead?\n\nI get the following output: \n\n```shell\nsubprocess forked\nzsh: terminated node test.js\n```\n\n### Additional information\n\n_No response_\n\n\u003c/details>","author":{"url":"https://github.com/vdata1","@type":"Person","name":"vdata1"},"datePublished":"2026-08-05T16:20:34Z","url":"https://github.com/nodejs/node/issues/65052"}
| 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:52a4fca9-f6dc-7fa7-49ff-0b69a6bba7ce |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9B06:A2B38:463B6A:5AD1AF:6AED2258 |
| html-safe-nonce | fd70b99485b90f834f3bc4f8c8844e6b35f186f71f9129415d58d832e6612376 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjA2OkEyQjM4OjQ2M0I2QTo1QUQxQUY6NkFFRDIyNTgiLCJ2aXNpdG9yX2lkIjoiMzYxNjU1MTA4MjgwOTY5Njg1NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b6cb52cbf039d3f997144dafd6561919d0775d2a234a51a91bfd54492d6bb46c |
| hovercard-subject-tag | issue:5072996842 |
| 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/65052/issue_layout |
| twitter:image | https://opengraph.githubassets.com/14bcf40b84b2a4452bb4dcb052e91d2035ae5da52444dcd7493d5a52611989b9/nodejs/node/issues/65052 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/14bcf40b84b2a4452bb4dcb052e91d2035ae5da52444dcd7493d5a52611989b9/nodejs/node/issues/65052 |
| og:image:alt | TipRewritten by @avivkeller Version v24.19.0, v26.6.0 Platform macOS Darwin Subsystem node:child_process What steps will reproduce the bug? Running .kill('SIGTERM') on an invalid child_process spaw... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | vdata1 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| 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 | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width