vercel / hyper

A terminal built on web technologies
https://hyper.is
MIT License
43.27k stars 3.52k forks source link

Ctrl+C not killing Node Windows 10, Background Process Created? #3659

Open LeonBlade opened 5 years ago

LeonBlade commented 5 years ago

Issue

Pressing Ctrl+C to quit certain applications spawned by npm do not kill the application (and more).

Verified this by changing the shell config option to be both Powershell and CMD and they both fail. Using bash however does not produce the same result. This seems to have something to do with Windows specifically.

I tested trying to stop the same process on CMD and Powershell not within Hyper and it works fine, so there is something causing this to happen only within the Hyper terminal itself.

I'm not sure this can be reproduced for others, but the exact command I run for my example happens to be something with npm start or npm run dev for example. One project runs a Koa server with Next.js, the other is using cgb-scripts. I also tried on another project with npm build which runs an electron build step and that also cannot be killed with Ctrl+C. Running node itself, the application will close just fine.

Closing the tab will NOT kill the process. If I close the tab, it will keep the process alive in the background. The only way to stop it, is by ending it in the Task Manager or Resource Monitor.

This has only been a recent issue since Hyper 3.

OmgImAlexis commented 5 years ago

I've also noticed CTRL+C not sending through hyper over SSH. I wonder if this is related.

Running this remotely via terminal on MacOS works without an issue yet with Hyper the script never runs the callback function.

process.on ('SIGINT',() => {
  console.log('You clicked Ctrl+C!');
  process.exit(1);
});

setInterval(() => {
        console.log('running');
}, 1000)

Macbook - Hyper over SSH (Ended up using kill -SIGINT $PID)

running
^C^Crunning
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^Crunning
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^Crunning
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^Crunning
^C^C^C^C^C^Crunning
^C^C^C^Crunning
running
running
running
running
running
running
You clicked Ctrl+C!

Macbook - Terminal over SSH

running
^CYou clicked Ctrl+C!