diff --git a/IPython/zmq/pykernel.py b/IPython/zmq/pykernel.py index 30d79eb..3991a17 100755 --- a/IPython/zmq/pykernel.py +++ b/IPython/zmq/pykernel.py @@ -60,7 +60,7 @@ class Kernel(HasTraits): # Build dict of handlers for message types msg_types = [ 'execute_request', 'complete_request', - 'object_info_request' ] + 'object_info_request', 'shutdown_request' ] self.handlers = {} for msg_type in msg_types: self.handlers[msg_type] = getattr(self, msg_type) @@ -163,6 +163,14 @@ class Kernel(HasTraits): object_info, parent, ident) print >> sys.__stdout__, msg + def shutdown_request(self, ident, parent): + content = dict(parent['content']) + msg = self.session.send(self.reply_socket, 'shutdown_reply', + content, parent, ident) + print >> sys.__stdout__, msg + time.sleep(0.1) + sys.exit(0) + #--------------------------------------------------------------------------- # Protected interface #---------------------------------------------------------------------------