Once you've done heavy math in Python, you'll have trouble getting Ctrl-C to stop:
$ python3 cext09.py
^C^C^C^C^C^C #do not stop
Ctrl-Z works, so there's a way to interrupt and kill:
^Z
zsh: suspended python3 cext09.py
$ jobs
[1] - running emacs cext09.c
[2] + suspended python3 cext09.py
$ kill %2
[2] + terminated python3 cext09.py
This is tedious and may kill the wrong one.
signal
Just write this in a Python script and you're good to go.
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
Recommended Posts