diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-10-12 00:04:07 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-10-12 04:33:53 +0200 |
commit | b182f247ecf5d49558aae165ba248e2240d3a5d7 (patch) | |
tree | 7f5cf775fed6d67a9e263d71e8e7dbd190305216 /src/clint.py | |
parent | ef4676ed5bd18fc2d5fb52b52304d59d94e9e806 (diff) | |
download | rneovim-b182f247ecf5d49558aae165ba248e2240d3a5d7.tar.gz rneovim-b182f247ecf5d49558aae165ba248e2240d3a5d7.tar.bz2 rneovim-b182f247ecf5d49558aae165ba248e2240d3a5d7.zip |
eval/term_write(): Skip writes if stream was closed.
If the backing stream for a :terminal was closed (e.g. if the shell exits
unexpectedly) there may be pending input on the loop which will be processed
before the terminal close event (which is queued on the same loop).
terminal_send checks term->closed but this does not reflect the state of the
underlying streams. The terminal.c module in fact has no knowledge of the
streams (this seems intentional: it is abstracted as TerminalOption.write_cb).
The SIGCHLD handler (pty_process_unix.c) is executed immediately, and it
triggers a stream teardown so Stream.closed=false (TerminalJobData.in.closed).
When the pending writes are handled by eval.c:term_write, wstream_write() aborts
because it sees the closed Stream.
To avoid that, this commit checks Stream.closed in eval:term_write() before writing
to the WStream. (As hinted above, we cannot do this in terminal:terminal_send()
because that module cannot inspect the underlying streams.)
References #5445
https://github.com/neovim/neovim/pull/5445#issuecomment-252529766
Diffstat (limited to 'src/clint.py')
0 files changed, 0 insertions, 0 deletions