Repository navigation
Conversation
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10165.
npx <pkg>/npm exec -- <pkg>now replaces the npm process with the command instead of spawning it and waiting:lib/commands/exec.jsasks for this only for a single command;--workspaceskeeps running one child per workspace.libnpmexecpasses it on to@npmcli/run-script, except in interactive mode (no command).For a plain bin call with the default
shit also prefixes the script withexec, so the shell is replaced as well;--callscripts and customscript-shells are left as they are.Besides the memory of the idle npm process, this also fixes orphaned processes: today npm only forwards SIGINT and SIGTERM, and the shell in between does not forward anything, so a SIGKILL (or a SIGTERM that reaches only the shell) leaves the actual program running with PPID 1.
MCP clients run into this a lot, because MCP servers are typically configured as
npx -y <pkg>(see anthropics/claude-code#76306 and anthropics/claude-code#1935).With this change the program is the process the caller started, so signals reach it directly.
Things that no longer happen after the handover, because npm is gone: the update notice and npm's own "command failed" messages on a non-zero exit.
The exit code is the program's own.
Depends on npm/promise-spawn#175 and npm/run-script#283; they need to be released and bundled for this to take effect.
The workaround for nodejs/node#66824 lives in
promise-spawn.Tested:
test/lib/commands/exec.jsandlibnpmexecat 100 % coverage on Node.js 22, 24 and 26.--call, interactive mode and--workspacesunchanged.