Skip to content
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] SIGINT (ctrl+c) makes npm 7 print error log #2124

Closed
jsg2021 opened this issue Nov 5, 2020 · 3 comments · Fixed by npm/run-script#16
Closed

[BUG] SIGINT (ctrl+c) makes npm 7 print error log #2124

jsg2021 opened this issue Nov 5, 2020 · 3 comments · Fixed by npm/run-script#16
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@jsg2021
Copy link

jsg2021 commented Nov 5, 2020

Maybe related to #1591 & #1947

Current Behavior:

If I stop a process started by an npm script (with ctrl+c) , its stops, but npm prints error log.

Expected Behavior:

Normal (silent) exit

Steps To Reproduce:

execute any package script and ctrl+c on it.
example:

 "start": "sleep 100"
ERR! path /home/jonathan/Workspace/test
npm ERR! command failed
npm ERR! signal SIGINT
npm ERR! command sh -c sleep 100

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/jonathan/.npm/_logs/2020-11-05T05_52_10_653Z-debug.log

Environment:

  • OS: Fedora 33
  • Node: 14.15.0
  • npm: 7.0.8
@jsg2021 jsg2021 added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Nov 5, 2020
@rapritchard
Copy link

rapritchard commented Nov 5, 2020

Also getting this behaviour when I try to stop a webpack dev mode. It stops but prints out the same error message. Started happening when I upgraded to npm -v 7.0.7

@isaacs
Copy link
Contributor

isaacs commented Nov 5, 2020

Hm, yeah, we did recently update to send the signal to the child process, whereas before it would just end up sending the default SIGHUP that a child process gets when its parent exits.

Maybe what we ought to do is, if we're passing the signal along, then don't treat a signal exit as a failure, but just make sure that the main process dies with the same signal. (Ie, do proc.kill('SIGINT'), and when the child dies with a signal exit, do process.kill(process.pid, signal) ; setTimeout(() => {}, 500) so that the main process dies in the same way.)

@ghost
Copy link

ghost commented Nov 6, 2020

I'm experiencing similar unexpected behavior within our application

npm ERR! path C:\Users\Daan\Documents\GitHub\Stew
npm ERR! command failed
npm ERR! signal SIGINT
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "node ./src/ "login""

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Daan\AppData\Local\npm-cache\_logs\2020-11-06T10_04_20_600Z-debug.log
Terminate batch job (Y/N)?

Due to this bug, certain operations at the end of our process can't be done, resulting in a downgrade to Node LTS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants