diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-10-19 02:09:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-19 02:09:29 +0200 |
commit | 6a6f188d2ac457266c47732bf19ef8c60e79959b (patch) | |
tree | 9c0288adb64b6779b6e19dfc873f1ba0fe65b16f /src/nvim/os/shell.c | |
parent | 657ba62a84de4ae0fd6dbaa2d3c238de4b372669 (diff) | |
parent | 9706664b8827614817a43f3a4ac4b6ae8463a906 (diff) | |
download | rneovim-6a6f188d2ac457266c47732bf19ef8c60e79959b.tar.gz rneovim-6a6f188d2ac457266c47732bf19ef8c60e79959b.tar.bz2 rneovim-6a6f188d2ac457266c47732bf19ef8c60e79959b.zip |
Merge #5502 from justinmk/error-write-to-bg-process
system('foo &', 'bar'): Show error, don't crash.
Diffstat (limited to 'src/nvim/os/shell.c')
-rw-r--r-- | src/nvim/os/shell.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index e9a3dcbff8..18ee008d66 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -545,6 +545,16 @@ static size_t write_output(char *output, size_t remaining, bool to_buffer, static void shell_write_cb(Stream *stream, void *data, int status) { + if (status) { + // Can happen if system() tries to send input to a shell command that was + // backgrounded (:call system("cat - &", "foo")). #3529 #5241 + EMSG2(_("E5677: Error writing input to shell-command: %s"), + uv_err_name(status)); + } + if (stream->closed) { // Process may have exited before this write. + ELOG("stream was already closed"); + return; + } stream_close(stream, NULL, NULL); } |