Cygwin's bash is often preferable to Windows' cmd command shell, so we use it to set up our environments before spawning a Windows shell. However, halting execution of a running process in this spawned shell with Ctrl-C kills boots the user back to the bash shell.
My attempted workaround:
source setupEnvironment.sh
restartCommand() {
# Reset trap
trap restartCommand SIGINT
echo -e " === Restarting windows cmd prompt\n"
cmd /k
}
trap restartCommand SIGINT
echo -e " === Starting windows cmd prompt\n"
cmd /k
This approach only restarts cmd once. Subsequent Ctrl-C's are not caught. Is there a way to keep restarting the cmd process?