Skip to content

Commit 866f4f8

Browse files
authored
Fix for the terminal shutdown issue (#4180)
This patch prevents creation of a new terminal when handling websocket handshaking request. The default behavior of `terminado.NamedTermManager` is to automatically start a new terminal in response to a websocket handshake, which prevents a terminal from being properly shut down in JupyterLab as reported in this [issue](jupyterlab/jupyterlab#5061).
1 parent b5b44eb commit 866f4f8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

notebook/terminal/handlers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def origin_check(self):
3131
def get(self, *args, **kwargs):
3232
if not self.get_current_user():
3333
raise web.HTTPError(403)
34+
if not args[0] in self.term_manager.terminals:
35+
raise web.HTTPError(404)
3436
return super(TermSocket, self).get(*args, **kwargs)
3537

3638
def on_message(self, message):

0 commit comments

Comments
 (0)