From d70249c94836d682588e3fda8feb752cdb14e8a4 2012-04-14 22:30:55 From: MinRK Date: 2012-04-14 22:30:55 Subject: [PATCH] re-enter kernel.eventloop after catching SIGINT --- diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 1c8a258..33b70cb 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -201,12 +201,17 @@ class Kernel(Configurable): # stop ignoring sigint, now that we are out of our own loop, # we don't want to prevent future code from handling it signal(SIGINT, default_int_handler) - if self.eventloop is not None: + while self.eventloop is not None: try: self.eventloop(self) except KeyboardInterrupt: # Ctrl-C shouldn't crash the kernel io.raw_print("KeyboardInterrupt caught in kernel") + continue + else: + # eventloop exited cleanly, this means we should stop (right?) + self.eventloop = None + break def record_ports(self, ports):