-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[BUG] trap hook terminated #6147
Labels
Bug
thing that needs fixing
Priority 2
secondary priority issue
Release 9.x
work is associated with a specific npm 9 release
Comments
I'm not able to reproduce this in
|
Looks like this can still happen in some cases. |
Yes, I'm still seeing it with NPM v9.6.0.
|
Seems to be fixed in NPM v9.7.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
thing that needs fixing
Priority 2
secondary priority issue
Release 9.x
work is associated with a specific npm 9 release
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Scripts run via
npm run
have their trap hooks terminated prematurely. This is undesirable because the script does not get a chance to clean up after itself. Worse, it might clean up only some of its mess.Expected Behavior
Any Bash "trap" hooks to run to completion.
Steps To Reproduce
Create a file demo.sh containing
and make it executable with
chmod +x demo.sh
. Notice that it has a trap hook that runs on exit. The hook echoes "start", does some work, then echoes "end". Declare it as the script "demo" in a package.json file:Run the "demo" script, then interrupt it by typing ctrl-c. Notice that the trap hook does not run to completion:
On the other hand, running the script directly runs the trap hook to completion:
Environment
The text was updated successfully, but these errors were encountered: