|
53 | 53 | from .iostream import IOPubThread
|
54 | 54 | from .ipkernel import IPythonKernel
|
55 | 55 | from .parentpoller import ParentPollerUnix, ParentPollerWindows
|
| 56 | +from .shellchannel import ShellChannelThread |
56 | 57 | from .zmqshell import ZMQInteractiveShell
|
57 | 58 |
|
58 | 59 | # -----------------------------------------------------------------------------
|
@@ -143,6 +144,7 @@ class IPKernelApp(BaseIPythonApplication, InteractiveShellApp, ConnectionFileMix
|
143 | 144 | iopub_socket = Any()
|
144 | 145 | iopub_thread = Any()
|
145 | 146 | control_thread = Any()
|
| 147 | + shell_channel_thread = Any() |
146 | 148 |
|
147 | 149 | _ports = Dict()
|
148 | 150 |
|
@@ -367,6 +369,7 @@ def init_control(self, context):
|
367 | 369 | self.control_socket.router_handover = 1
|
368 | 370 |
|
369 | 371 | self.control_thread = ControlThread(daemon=True)
|
| 372 | + self.shell_channel_thread = ShellChannelThread(context, self.shell_socket, daemon=True) |
370 | 373 |
|
371 | 374 | def init_iopub(self, context):
|
372 | 375 | """Initialize the iopub channel."""
|
@@ -406,6 +409,10 @@ def close(self):
|
406 | 409 | self.log.debug("Closing control thread")
|
407 | 410 | self.control_thread.stop()
|
408 | 411 | self.control_thread.join()
|
| 412 | + if self.shell_channel_thread and self.shell_channel_thread.is_alive(): |
| 413 | + self.log.debug("Closing shell channel thread") |
| 414 | + self.shell_channel_thread.stop() |
| 415 | + self.shell_channel_thread.join() |
409 | 416 |
|
410 | 417 | if self.debugpy_socket and not self.debugpy_socket.closed:
|
411 | 418 | self.debugpy_socket.close()
|
@@ -562,6 +569,7 @@ def init_kernel(self):
|
562 | 569 | debug_shell_socket=self.debug_shell_socket,
|
563 | 570 | shell_socket=self.shell_socket,
|
564 | 571 | control_thread=self.control_thread,
|
| 572 | + shell_channel_thread=self.shell_channel_thread, |
565 | 573 | iopub_thread=self.iopub_thread,
|
566 | 574 | iopub_socket=self.iopub_socket,
|
567 | 575 | stdin_socket=self.stdin_socket,
|
|
0 commit comments