When I run this:
echo '
from signal import *; signal(SIGINT, lambda *_: sys.exit(0)); # Does not work
from socket import *; socket(AF_INET, SOCK_DGRAM).recvfrom(0);
' | ssh host -- python -
pressing Ctrl+C causes SSH to quit without terminating Python.
How can I property get Python to terminate on Ctrl+C?