##// END OF EJS Templates
Merge pull request #8483 from Carreau/keep-kernel...
Thomas Kluyver -
r21403:a4c5f92a merge
parent child Browse files
Show More
@@ -113,6 +113,7 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):'
113 manager=self.kernel_manager,
113 manager=self.kernel_manager,
114 client=self.kernel_client,
114 client=self.kernel_client,
115 )
115 )
116 self.shell.own_kernel = not self.existing
116
117
117 def init_gui_pylab(self):
118 def init_gui_pylab(self):
118 # no-op, because we don't want to import matplotlib in the frontend.
119 # no-op, because we don't want to import matplotlib in the frontend.
@@ -212,6 +212,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):'
212 elif source == 'set_next_input':
212 elif source == 'set_next_input':
213 self.set_next_input(item['text'])
213 self.set_next_input(item['text'])
214 elif source == 'ask_exit':
214 elif source == 'ask_exit':
215 self.keepkernel=item.get('keepkernel', False)
215 self.ask_exit()
216 self.ask_exit()
216
217
217 elif status == 'error':
218 elif status == 'error':
@@ -409,6 +410,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):'
409 self.client.input(raw_data)
410 self.client.input(raw_data)
410
411
411 def mainloop(self, display_banner=False):
412 def mainloop(self, display_banner=False):
413 self.keepkernel = False
412 while True:
414 while True:
413 try:
415 try:
414 self.interact(display_banner=display_banner)
416 self.interact(display_banner=display_banner)
@@ -421,6 +423,14 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):'
421 # handling seems rather unpredictable...
423 # handling seems rather unpredictable...
422 self.write("\nKeyboardInterrupt in interact()\n")
424 self.write("\nKeyboardInterrupt in interact()\n")
423
425
426
427 if self.keepkernel and not self.own_kernel:
428 print('keeping kernel alive')
429 elif self.keepkernel and self.own_kernel :
430 print("owning kernel, cannot keep it alive")
431 self.client.shutdown()
432 else :
433 print("Shutting down kernel")
424 self.client.shutdown()
434 self.client.shutdown()
425
435
426 def _banner1_default(self):
436 def _banner1_default(self):
General Comments 0
You need to be logged in to leave comments. Login now