summaryrefslogtreecommitdiffstats
path: root/runtime/doc/channel.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/channel.txt')
-rw-r--r--runtime/doc/channel.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index 73105986f6..2c3f837300 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -418,7 +418,11 @@ This uses the channel timeout. To read without a timeout, just get any
message that is available: >
let output = ch_read(channel, {'timeout': 0})
When no message was available then the result is v:none for a JSON or JS mode
-channels, an empty string for a RAW or NL channel.
+channels, an empty string for a RAW or NL channel. You can use |ch_canread()|
+to check if there is something to read.
+
+Note that when there is no callback message are dropped. To avoid that add a
+close callback to the channel.
To read all output from a RAW channel that is available: >
let output = ch_readraw(channel)
@@ -470,6 +474,11 @@ This depends on the system (on Unix this happens because closing the write end
of a pipe causes the read end to get EOF). To avoid this make the job sleep
for a short while before it exits.
+Note that if the job exits before you read the output, the output may be lost.
+This depends on the system (on Unix this happens because closing the write end
+of a pipe causes the read end to get EOF). To avoid this make the job sleep
+for a short while before it exits.
+
The handler defined for "out_cb" will not receive stderr. If you want to
handle that separately, add an "err_cb" handler: >
let job = job_start(command, {"out_cb": "MyHandler",