diff runtime/doc/channel.txt @ 10422:e664ee056a84 v8.0.0105

commit https://github.com/vim/vim/commit/4b785f69c0616dba5d3f38e8ce4b5398cec89407 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 29 21:54:44 2016 +0100 patch 8.0.0105 Problem: When using ch_read() with zero timeout, can't tell the difference between reading an empty line and nothing available. Solution: Add ch_canread().
author Christian Brabandt <cb@256bit.org>
date Tue, 29 Nov 2016 22:00:05 +0100
parents 368468ef35cf
children acfc83aca8ee
line wrap: on
line diff
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -418,7 +418,11 @@ This uses the channel timeout.  To read 
 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
 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",