summaryrefslogtreecommitdiffstats
path: root/runtime/doc/channel.txt
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-08-11 19:12:11 +0200
committerBram Moolenaar <Bram@vim.org>2017-08-11 19:12:11 +0200
commit05aafed54b50b602315ae55d83a7d089804cecb0 (patch)
tree5ba15103a30540de184b50ca8d82a7adaa2efd4d /runtime/doc/channel.txt
parent76ca1b4041db71df899a40d2ab1701af4f19cb2a (diff)
patch 8.0.0902: cannot specify directory or environment for a jobv8.0.0902
Problem: Cannot specify directory or environment for a job. Solution: Add the "cwd" and "env" arguments to job options. (Yasuhiro Matsumoto, closes #1160)
Diffstat (limited to 'runtime/doc/channel.txt')
-rw-r--r--runtime/doc/channel.txt22
1 files changed, 11 insertions, 11 deletions
diff --git a/runtime/doc/channel.txt b/runtime/doc/channel.txt
index f85c15022e..b9af2e6d82 100644
--- a/runtime/doc/channel.txt
+++ b/runtime/doc/channel.txt
@@ -427,8 +427,8 @@ 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. 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.
+Note that when there is no callback, messages 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)
@@ -475,11 +475,6 @@ 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",
@@ -494,6 +489,11 @@ started job gets the focus. To avoid that, use the `foreground()` function.
This might not always work when called early, put in the callback handler or
use a timer to call it after the job has started.
+Depending on the system, starting a job can put Vim in the background, the
+started job gets the focus. To avoid that, use the `foreground()` function.
+This might not always work when called early, put in the callback handler or
+use a timer to call it after the job has started.
+
You can send a message to the command with ch_evalraw(). If the channel is in
JSON or JS mode you can use ch_evalexpr().
@@ -696,6 +696,10 @@ See |job_setoptions()| and |ch_setoptions()|.
"block_write": number only for testing: pretend every other write to stdin
will block
+"env": dict environment variables for the new process
+"cwd": "/path/to/dir" current working directory for the new process;
+ if the directory does not exist an error is given
+
Writing to a buffer ~
*out_io-buffer*
@@ -731,10 +735,6 @@ The "out_msg" option can be used to specify whether a new buffer will have the
first line set to "Reading from channel output...". The default is to add the
message. "err_msg" does the same for channel error.
-'modifiable' option off, or write to a buffer that has 'modifiable' off. That
-means that lines will be appended to the buffer, but the user can't easily
-change the buffer.
-
When an existing buffer is to be written where 'modifiable' is off and the
"out_modifiable" or "err_modifiable" options is not zero, an error is given
and the buffer will not be written to.