Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set websocket.terminal to None when the child exits #55

Merged
merged 1 commit into from
Apr 2, 2018

Conversation

takluyver
Copy link
Member

This fixes an error I was seeing when exiting a terminal which is open in multiple tabs at the same time. The code path to resize the terminal to the smallest client window size was taken, which tries to communicate with the (now closed) terminal:

[E 10:17:30.026 NotebookApp] Uncaught exception GET /terminals/websocket/1 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/terminals/websocket/1', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "/home/takluyver/.local/lib/python3.6/site-packages/tornado/web.py", line 1499, in _stack_context_handle_exception
        raise_exc_info((type, value, traceback))
      File "<string>", line 4, in raise_exc_info
      File "/home/takluyver/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 315, in wrapped
        ret = fn(*args, **kwargs)
      File "/home/takluyver/.local/lib/python3.6/site-packages/tornado/websocket.py", line 440, in on_connection_close
        self.on_close()
      File "/home/takluyver/.local/lib/python3.6/site-packages/terminado/websocket.py", line 95, in on_close
        self.terminal.resize_to_smallest()
      File "/home/takluyver/.local/lib/python3.6/site-packages/terminado/management.py", line 61, in resize_to_smallest
        rows, cols = self.ptyproc.getwinsize()
      File "/home/takluyver/.local/lib/python3.6/site-packages/ptyprocess/ptyprocess.py", line 772, in getwinsize
        x = fcntl.ioctl(self.fd, TIOCGWINSZ, s)
    ValueError: file descriptor cannot be a negative integer (-1)

This fixes an error I was seeing when exiting a terminal which is open
in multiple tabs at the same time. The code path to resize the terminal
to the smallest client window size was taken, which tries to communicate
with the (now closed) terminal.
@minrk minrk merged commit 7fde385 into master Apr 2, 2018
@minrk minrk deleted the exiting-w-multiple-tabs branch April 4, 2018 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants