Show More
@@ -113,6 +113,7 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):' | |||
|
113 | 113 | manager=self.kernel_manager, |
|
114 | 114 | client=self.kernel_client, |
|
115 | 115 | ) |
|
116 | self.shell.own_kernel = not self.existing | |
|
116 | 117 | |
|
117 | 118 | def init_gui_pylab(self): |
|
118 | 119 | # no-op, because we don't want to import matplotlib in the frontend. |
@@ -212,6 +212,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||
|
212 | 212 | elif source == 'set_next_input': |
|
213 | 213 | self.set_next_input(item['text']) |
|
214 | 214 | elif source == 'ask_exit': |
|
215 | self.keepkernel=item.get('keepkernel', False) | |
|
215 | 216 | self.ask_exit() |
|
216 | 217 | |
|
217 | 218 | elif status == 'error': |
@@ -233,7 +234,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||
|
233 | 234 | Only relevant if include_other_output is True. |
|
234 | 235 | """ |
|
235 | 236 | ) |
|
236 | ||
|
237 | ||
|
237 | 238 | def from_here(self, msg): |
|
238 | 239 | """Return whether a message is from this session""" |
|
239 | 240 | return msg['parent_header'].get("session", self.session_id) == self.session_id |
@@ -409,6 +410,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||
|
409 | 410 | self.client.input(raw_data) |
|
410 | 411 | |
|
411 | 412 | def mainloop(self, display_banner=False): |
|
413 | self.keepkernel = False | |
|
412 | 414 | while True: |
|
413 | 415 | try: |
|
414 | 416 | self.interact(display_banner=display_banner) |
@@ -421,7 +423,15 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||
|
421 | 423 | # handling seems rather unpredictable... |
|
422 | 424 | self.write("\nKeyboardInterrupt in interact()\n") |
|
423 | 425 | |
|
424 | self.client.shutdown() | |
|
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") | |
|
434 | self.client.shutdown() | |
|
425 | 435 | |
|
426 | 436 | def _banner1_default(self): |
|
427 | 437 | return "IPython Console {version}\n".format(version=release.version) |
General Comments 0
You need to be logged in to leave comments.
Login now