From 630bed72da113bb2d3fc3c125b5a4110f7d7a409 2011-05-26 12:32:05 From: Thomas Kluyver Date: 2011-05-26 12:32:05 Subject: [PATCH] Kernel event loop is robust against random SIGINT. --- diff --git a/IPython/zmq/ipkernel.py b/IPython/zmq/ipkernel.py index 51cfb9d..93b1ad3 100755 --- a/IPython/zmq/ipkernel.py +++ b/IPython/zmq/ipkernel.py @@ -167,8 +167,12 @@ class Kernel(Configurable): """ Start the kernel main loop. """ while True: - time.sleep(self._poll_interval) - self.do_one_iteration() + try: + time.sleep(self._poll_interval) + self.do_one_iteration() + except KeyboardInterrupt: + # Ctrl-C shouldn't crash the kernel + continue def record_ports(self, xrep_port, pub_port, req_port, hb_port): """Record the ports that this kernel is using.