From 0b1468884a2a1c5d3442cbb7119330e307f0aa3d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 6 Sep 2018 16:27:24 +0200 Subject: patch 8.1.0350: Vim may block on ch_sendraw() Problem: Vim may block on ch_sendraw() when the job is sending data back to Vim, which isn't read yet. (Nate Bosch) Solution: Add the "noblock" option to job_start(). (closes #2548) --- runtime/doc/channel.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'runtime') diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt index 4cc36258c0..fd08cd4974 100644 --- a/runtime/doc/channel.txt +++ b/runtime/doc/channel.txt @@ -163,6 +163,9 @@ Use |ch_status()| to see if the channel could be opened. The "close_cb" is also considered for this. "never" All messages will be kept. + *channel-noblock* +"noblock" Same effect as |job-noblock|. Only matters for writing. + *waittime* "waittime" The time to wait for the connection to be made in milliseconds. A negative number waits forever. @@ -594,6 +597,17 @@ See |job_setoptions()| and |ch_setoptions()|. Note: when writing to a file or buffer and when reading from a buffer NL mode is used by default. + *job-noblock* +"noblock": 1 When writing use a non-blocking write call. This + avoids getting stuck if Vim should handle other + messages in between, e.g. when a job sends back data + to Vim. It implies that when `ch_sendraw()` returns + not all data may have been written yet. + This option was added in patch 8.1.0350, test with: > + if has("patch-8.1.350") + let options['noblock'] = 1 + endif +< *job-callback* "callback": handler Callback for something to read on any part of the channel. -- cgit v1.2.3