From f109ece147b706f0afda92fa8c05357cab3f3f7b 2012-11-07 19:42:04 From: MinRK Date: 2012-11-07 19:42:04 Subject: [PATCH] ignore SIGINT in paramiko tunnel subprocesses --- diff --git a/IPython/external/ssh/tunnel.py b/IPython/external/ssh/tunnel.py index 9ae2311..c63f0ce 100644 --- a/IPython/external/ssh/tunnel.py +++ b/IPython/external/ssh/tunnel.py @@ -22,6 +22,7 @@ Authors from __future__ import print_function import os,sys, atexit +import signal import socket from multiprocessing import Process from getpass import getpass, getuser @@ -331,9 +332,10 @@ def _paramiko_tunnel(lport, rport, server, remoteip, keyfile=None, password=None except Exception as e: print ('*** Failed to connect to %s:%d: %r' % (server, port, e)) sys.exit(1) - - # print ('Now forwarding port %d to %s:%d ...' % (lport, server, rport)) - + + # Don't let SIGINT kill the tunnel subprocess + signal.signal(signal.SIGINT, signal.SIG_IGN) + try: forward_tunnel(lport, remoteip, rport, client.get_transport()) except KeyboardInterrupt: