-
Notifications
You must be signed in to change notification settings - Fork 245
cross-env is swallowing "Ctrl + C" command on Windows 10 #178
Comments
Thanks for the report @bennyn. Would you be willing to dig a little deeper and suggest a solution for this problem? |
I will try to dig a little deeper but first I need to understand how signal interrupts are passed on in Node.js. I saw that @slavik57 reported something similar (CTRL+C does not kill the child process) and traced it down to Node itself. 🤔 |
Great insights! I found out that if I replace I then followed your best practices and split my "start": "yarn start:monitor",
"start:monitor": "cross-env NODE_ENV=production yarn start:monitor:shell"
"start:monitor:shell":" "cross-env-shell node dist/app/monitor.js", This works now for me so I will close the isse! 🎉 But it might be considered mentioning this within the |
I'm glad you got that worked out! Feel free to open a PR to update the README. |
Your wish is my command! 😃 |
cross-env
version: 5.1.5node
version: 8.9.4yarn
version: 1.3.2Relevant code or config:
package.json
monitor.ts
What you did:
node dist/app/monitor.js
Ctrl + C
(on Windows 10) while the program was runningSIGINT
cross-env
usingnpx cross-env NODE_ENV=production node dist/app/monitor.js
Ctrl + C
Ctrl + C
inputExpected result:
I was thinking that my code will run into the
exit
function when running my program withcross-env
usingnpx cross-env NODE_ENV=production node dist/app/monitor.js
and pressingCtrl + C
but unfortunately it doesn't.My
process.on('SIGINT')
handler is only called when runningnode dist/app/monitor.js
(without "cross-env").The text was updated successfully, but these errors were encountered: