summaryrefslogtreecommitdiffstats
path: root/runtime/doc/channel.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-10-01 14:47:05 +0200
committerBram Moolenaar <Bram@vim.org>2016-10-01 14:47:05 +0200
commit2ec618c9feac4573b154510236ad8121c77d0eca (patch)
tree5a0d1b003e7829d735719a7795c5cdeb9959a74d /runtime/doc/channel.txt
parentb3435b0a3a0967115658d0a8c0224a28969cfa02 (diff)
Updated runtime files.
Diffstat (limited to 'runtime/doc/channel.txt')
-rw-r--r--runtime/doc/channel.txt9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index 7c286f3aa0..6588c9e79f 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -1,4 +1,4 @@
-*channel.txt* For Vim version 8.0. Last change: 2016 Sep 20
+*channel.txt* For Vim version 8.0. Last change: 2016 Sep 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -465,6 +465,11 @@ it like this: >
Without the handler you need to read the output with |ch_read()| or
|ch_readraw()|. You can do this in the close callback, see |read-in-close-cb|.
+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",
@@ -516,7 +521,7 @@ If the job can take some time and you don't need intermediate results, you can
add a close callback and read the output there: >
func! CloseHandler(channel)
- while ch_status(a:channel) == 'buffered'
+ while ch_status(a:channel, {'part': 'out'}) == 'buffered'
echomsg ch_read(a:channel)
endwhile
endfunc