Skip to content

Restore npm SIGINT behavior (reverts #41) #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

isaacl
Copy link

@isaacl isaacl commented Aug 16, 2025

This reverts the behavioral change from #41.

This change caused pnpm to improperly handle interactive
shell Ctrl-C, trapping the received signal and also ignoring
the abnormal exit of the script. This often results still
in a quick exit (because the script has terminated), but
with exit code 0.

PR #41 resulted in incorrect behavior, which also diverges
from npm (as well as node --run). As another problem, it
made pnpm internally inconsistent as Ctrl-C results in non-zero
in situations when lifecycles scripts are not actively running.
Even in the context of pnpm run <X>, a very quick Ctrl-C, prior
to spawn, results in a non-zero pnpm exit.

For additional discussion see: #51

Fixes: pnpm/pnpm#9626

This reverts the behavioral change from pnpm#41.

This change caused pnpm to improperly handle interactive
shell Ctrl-C, trapping the received signal and also ignoring
the abnormal exit of the script. This often results still
in a quick exit (because the script has terminated), but
with exit code 0.

PR pnpm#41 resulted in incorrect behavior, which also diverges
from npm (as well as `node --run`). As another problem, it
made pnpm internally inconsistent as Ctrl-C results in non-zero
in situations when lifecycles scripts are not actively running.
Even in the context of pnpm run, a very quick Ctrl-C, prior to
spawn, results in a non-zero pnpm exit.

For additional discussion see: pnpm#51

Fixes: pnpm/pnpm#9626
@isaacl isaacl force-pushed the fixSigintHandling branch from 37ef97b to b8c0479 Compare August 16, 2025 21:14
@isaacl
Copy link
Author

isaacl commented Aug 18, 2025

@zkochan

cc: @yanickrochon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pnpm run emits incorrect exit code when interrupted
1 participant