Skip to content

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

Closed
npm/run-script
#16

Description

@jsg2021

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

Activity

  1. added
    Bug
    Needs Triage
    Release 7.x
    on Nov 5, 2020
  2. rapritchard commented on Nov 5, 2020

    @rapritchard

    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

  3. isaacs commented on Nov 5, 2020

    @isaacs
    Contributor

    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.)

  4. reopened this on Nov 6, 2020
  5. added a commit that references this issue on Nov 6, 2020
    74325f5
  6. added this to the OSS - Sprint 19 milestone on Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds TriageRelease 7.x

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions