When you close Node application on Windows with Ctrl + C. You get a "Terminate batch job Y/N" question. The annoying part is that it doesn't matter what you answer, the end result will be the same: application closes.
The question doesn't have any purpose on this particular case, so I started to investigate is there a setting or any other way to prevent it.
I found other frustrated people asking the same question:
- SuperUser - How to supress “Terminate batch job (Y/N)” confirmation?
- StackOverflow - How can I suppress the “terminate batch job” in cmd.exe
- GitHub - Meteor repository - Must press Ctrl+C twice, and get "Terminate batch job (Y/N)?" multiple times
Answers varied from hard-core solutions like patching the cmd.exe to bypassing the problem by hitting the Ctrl + C twice.
Solution that worked for me
The command that we use to start the application is quite long:
gulp build:frontend serve:frontend serve:account serve:connectors
We needed a shortcut for that and it had to be as platform agnostic as possible. We support multiple development environments (Windows & MacOS currently).
I created a shell script (dev_start.sh) which can be used also in Windows PowerShell:
echo "Starting Dear Lucy dev environment" gulp build:frontend serve:frontend serve:account serve:connectors
A "by-product" of this is that when you press Ctrl + C, you'll immediately exit the application.
No more annoying questions and double Ctrl + C!