Capturing SIGINT using KeyboardInterrupt exception works in terminal, not in script Capturing SIGINT using KeyboardInterrupt exception works in terminal, not in script shell shell