Title: child_process.exitCode is null after process exited · Issue #60285 · nodejs/node · GitHub
Open Graph Title: child_process.exitCode is null after process exited · Issue #60285 · nodejs/node
X Title: child_process.exitCode is null after process exited · Issue #60285 · nodejs/node
Description: Version v22.14.0 Platform Darwin 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 arm64 Subsystem child_process What steps will reproduce the bug? let cp = require("child_proces...
Open Graph Description: Version v22.14.0 Platform Darwin 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 arm64 Subsystem child_process What steps will reproduce...
X Description: Version v22.14.0 Platform Darwin 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 arm64 Subsystem child_process What steps will reproduce...
Opengraph URL: https://github.com/nodejs/node/issues/60285
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"child_process.exitCode is null after process exited","articleBody":"### Version\n\nv22.14.0\n\n### Platform\n\n```text\nDarwin 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 arm64\n```\n\n### Subsystem\n\nchild_process\n\n### What steps will reproduce the bug?\n\n```\nlet cp = require(\"child_process\")\n\nnew Promise(async () =\u003e {\n let proc = cp.spawn(\"node\")\n proc.on(\"close\", () =\u003e { console.log(\"CLOSE\") })\n proc.on(\"exit\", () =\u003e { console.log(\"EXIT\") })\n await new Promise((resolve) =\u003e { setTimeout(resolve, 1000) })\n\n console.log(\"before kill\", proc.killed, proc.signalCode, proc.exitCode)\n proc.kill(\"SIGKILL\")\n console.log(\"after kill\", proc.killed, proc.signalCode, proc.exitCode)\n await new Promise((resolve) =\u003e { setTimeout(resolve, 1000) })\n console.log(\"after wait\", proc.killed, proc.signalCode, proc.exitCode)\n})\n```\nprints:\n```\nbefore kill false null null\nafter kill true null null\nEXIT\nCLOSE\nafter wait true SIGKILL null\n```\n\n### How often does it reproduce? Is there a required condition?\n\nalways, with these versions on this system\n v14.16.1\n v20.18.0\n v22.14.0\n v25.0.0\n\nand with v22.18.0 on Linux 6.1.151-cip46-arm64 SMP Tue Oct 14 14:45:25 UTC 2025 aarch64 GNU/Linux\n\n### What is the expected behavior? Why is that the expected behavior?\n\nThe [documentation](https://nodejs.org/docs/latest-v22.x/api/child_process.html#subprocessexitcode) states:\n\u003e The subprocess.exitCode property indicates the exit code of the child process. If the child process is still running, the field will be null.\n\n\n\n### What do you see instead?\n\n`proc.exitCode` is always `null` even after the process has exited/closed\n\n### Additional information\n\nMaybe an error in the documentation?","author":{"url":"https://github.com/giuliomoro","@type":"Person","name":"giuliomoro"},"datePublished":"2025-10-16T20:42:55.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/60285/node/issues/60285"}
| 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:97182fb9-88e5-9671-570e-af2cc7d3e32b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C27C:22487B:E933BC:1467F3A:6A4BEB1B |
| html-safe-nonce | b0fa3caaa82c1291ba8e01817f3f7db7706329ff044c2a6408ac81d8ee4b2810 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjdDOjIyNDg3QjpFOTMzQkM6MTQ2N0YzQTo2QTRCRUIxQiIsInZpc2l0b3JfaWQiOiI0MTM4MTI2MTQ3Mzc5MjYwMTg4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 5441eb398fbe4827c5753105ef774dd224a958d1365a59dddab7d7cf18bac7dc |
| hovercard-subject-tag | issue:3523454723 |
| 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/60285/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c5af25231467e813ec59368d5933062b8858c24f761aa8ebb670cc638c0d5e2f/nodejs/node/issues/60285 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c5af25231467e813ec59368d5933062b8858c24f761aa8ebb670cc638c0d5e2f/nodejs/node/issues/60285 |
| og:image:alt | Version v22.14.0 Platform Darwin 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 arm64 Subsystem child_process What steps will reproduce... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | giuliomoro |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0f5d3ba365b3985d75c32a5957c8635488d58dcf027ae6ae958eee7edaa306a2 |
| 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 | f24da9b76b42d77b0bb458f810509565e9ba5f1a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width