0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 7.4.1560

Problem:    Dict options with a dash are more difficult to use.
Solution:   Use an underscore, so that dict.err_io can be used.
This commit is contained in:
Bram Moolenaar
2016-03-14 23:22:59 +01:00
parent 1735bc988c
commit d6c2f05260
5 changed files with 134 additions and 132 deletions

View File

@@ -1,4 +1,4 @@
*channel.txt* For Vim version 7.4. Last change: 2016 Mar 12 *channel.txt* For Vim version 7.4. Last change: 2016 Mar 14
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -127,10 +127,10 @@ Use |ch_status()| to see if the channel could be opened.
"js" - Use JS (JavaScript) encoding, more efficient than JSON. "js" - Use JS (JavaScript) encoding, more efficient than JSON.
"nl" - Use messages that end in a NL character "nl" - Use messages that end in a NL character
"raw" - Use raw messages "raw" - Use raw messages
*in_mode* *out_mode* *err_mode*
"in-mode" mode specifically for stdin, only when using pipes "in_mode" mode specifically for stdin, only when using pipes
"out-mode" mode specifically for stdout, only when using pipes "out_mode" mode specifically for stdout, only when using pipes
"err-mode" mode specifically for stderr, only when using pipes "err_mode" mode specifically for stderr, only when using pipes
Note: when setting "mode" the part specific mode is Note: when setting "mode" the part specific mode is
overwritten. Therefore set "mode" first and the part specific overwritten. Therefore set "mode" first and the part specific
mode later. mode later.
@@ -138,7 +138,7 @@ Use |ch_status()| to see if the channel could be opened.
Note: when writing to a file or buffer and when reading from a Note: when writing to a file or buffer and when reading from a
buffer NL mode is used by default. buffer NL mode is used by default.
*channel-callback* *channel-callback* *E921*
"callback" A function that is called when a message is received that is "callback" A function that is called when a message is received that is
not handled otherwise. It gets two arguments: the channel not handled otherwise. It gets two arguments: the channel
and the received message. Example: > and the received message. Example: >
@@ -153,17 +153,17 @@ Use |ch_status()| to see if the channel could be opened.
excluding the NL. excluding the NL.
When "mode" is "raw" the "msg" argument is the whole message When "mode" is "raw" the "msg" argument is the whole message
as a string. as a string.
*out-cb* *out_cb*
"out-cb" A function like "callback" but used for stdout. Only for when "out_cb" A function like "callback" but used for stdout. Only for when
the channel uses pipes. When "out-cb" wasn't set the channel the channel uses pipes. When "out_cb" wasn't set the channel
callback is used. callback is used.
*err-cb* *err_cb*
"err-cb" A function like "callback" but used for stderr. Only for when "err_cb" A function like "callback" but used for stderr. Only for when
the channel uses pipes. When "err-cb" wasn't set the channel the channel uses pipes. When "err_cb" wasn't set the channel
callback is used. callback is used.
*close-cb* *close_cb*
"close-cb" A function that is called when the channel gets closed, other "close_cb" A function that is called when the channel gets closed, other
than by calling ch_close(). It should be defined like this: > than by calling ch_close(). It should be defined like this: >
func MyCloseHandler(channel) func MyCloseHandler(channel)
< *waittime* < *waittime*
@@ -179,9 +179,9 @@ Use |ch_status()| to see if the channel could be opened.
"timeout" The time to wait for a request when blocking, E.g. when using "timeout" The time to wait for a request when blocking, E.g. when using
ch_evalexpr(). In milliseconds. The default is 2000 (2 ch_evalexpr(). In milliseconds. The default is 2000 (2
seconds). seconds).
*out-timeout* *err-timeout* *out_timeout* *err_timeout*
"out-timeout" Timeout for stdout. Only when using pipes. "out_timeout" Timeout for stdout. Only when using pipes.
"err-timeout" Timeout for stderr. Only when using pipes. "err_timeout" Timeout for stderr. Only when using pipes.
Note: when setting "timeout" the part specific mode is Note: when setting "timeout" the part specific mode is
overwritten. Therefore set "timeout" first and the part overwritten. Therefore set "timeout" first and the part
specific mode later. specific mode later.
@@ -440,7 +440,7 @@ been received and not parsed correctly.
If the command produces a line of output that you want to deal with, specify If the command produces a line of output that you want to deal with, specify
a handler for stdout: > a handler for stdout: >
let job = job_start(command, {"out-cb": "MyHandler"}) let job = job_start(command, {"out_cb": "MyHandler"})
The function will be called with the channel and a message. You would define The function will be called with the channel and a message. You would define
it like this: > it like this: >
func MyHandler(channel, msg) func MyHandler(channel, msg)
@@ -448,10 +448,10 @@ it like this: >
Without the handler you need to read the output with |ch_read()| or Without the handler you need to read the output with |ch_read()| or
|ch_readraw()|. |ch_readraw()|.
The handler defined for "out-cb" will not receive stderr. If you want to The handler defined for "out_cb" will not receive stderr. If you want to
handle that separately, add an "err-cb" handler: > handle that separately, add an "err_cb" handler: >
let job = job_start(command, {"out-cb": "MyHandler", let job = job_start(command, {"out_cb": "MyHandler",
\ "err-cb": "ErrHandler"}) \ "err_cb": "ErrHandler"})
If you want to handle both stderr and stdout with one handler use the If you want to handle both stderr and stdout with one handler use the
"callback" option: > "callback" option: >
@@ -463,7 +463,7 @@ JSON or JS mode you can use ch_evalexpr().
There are several options you can use, see |job-options|. There are several options you can use, see |job-options|.
For example, to start a job and write its output in buffer "dummy": > For example, to start a job and write its output in buffer "dummy": >
let logjob = job_start("tail -f /tmp/log", let logjob = job_start("tail -f /tmp/log",
\ {'out-io': 'buffer', 'out-name': 'dummy'}) \ {'out_io': 'buffer', 'out_name': 'dummy'})
sbuf dummy sbuf dummy
@@ -471,16 +471,16 @@ Job input from a buffer ~
To run a job that reads from a buffer: > To run a job that reads from a buffer: >
let job = job_start({command}, let job = job_start({command},
\ {'in-io': 'buffer', 'in-name': 'mybuffer'}) \ {'in_io': 'buffer', 'in_name': 'mybuffer'})
< <
*E915* *E918* *E915* *E918*
The buffer is found by name, similar to |bufnr()|. The buffer must exist and The buffer is found by name, similar to |bufnr()|. The buffer must exist and
be loaded when job_start() is called. be loaded when job_start() is called.
By default this reads the whole buffer. This can be changed with the "in-top" By default this reads the whole buffer. This can be changed with the "in_top"
and "in-bot" options. and "in_bot" options.
A special mode is when "in-top" is set to zero and "in-bot" is not set: Every A special mode is when "in_top" is set to zero and "in_bot" is not set: Every
time a line is added to the buffer, the last-but-one line will be send to the time a line is added to the buffer, the last-but-one line will be send to the
job stdin. This allows for editing the last line and sending it when pressing job stdin. This allows for editing the last line and sending it when pressing
Enter. Enter.
@@ -490,7 +490,7 @@ Enter.
To start another process without creating a channel: > To start another process without creating a channel: >
let job = job_start(command, let job = job_start(command,
\ {"in-io": "null", "out-io": "null", "err-io": "null"}) \ {"in_io": "null", "out_io": "null", "err_io": "null"})
This starts {command} in the background, Vim does not wait for it to finish. This starts {command} in the background, Vim does not wait for it to finish.
@@ -524,17 +524,17 @@ See |job_setoptions()| and |ch_setoptions()|.
*job-callback* *job-callback*
"callback": handler Callback for something to read on any part of the "callback": handler Callback for something to read on any part of the
channel. channel.
*job-out-cb* *job-out_cb*
"out-cb": handler Callback for when there is something to read on "out_cb": handler Callback for when there is something to read on
stdout. stdout.
*job-err-cb* *job-err_cb*
"err-cb": handler Callback for when there is something to read on "err_cb": handler Callback for when there is something to read on
stderr. stderr.
*job-close-cb* *job-close_cb*
"close-cb": handler Callback for when the channel is closed. Same as "close_cb": handler Callback for when the channel is closed. Same as
"close-cb" on ch_open(). "close_cb" on ch_open().
*job-exit-cb* *job-exit_cb*
"exit-cb": handler Callback for when the job ends. The arguments are the "exit_cb": handler Callback for when the job ends. The arguments are the
job and the exit status. job and the exit status.
Vim checks about every 10 seconds for jobs that ended. Vim checks about every 10 seconds for jobs that ended.
The callback can also be triggered by calling The callback can also be triggered by calling
@@ -557,37 +557,37 @@ See |job_setoptions()| and |ch_setoptions()|.
cause I/O errors. cause I/O errors.
Existing callbacks and other settings remain. Existing callbacks and other settings remain.
*job-in-io* *in-top* *in-bot* *in-name* *in-buf* *job-in_io* *in_top* *in_bot* *in_name* *in_buf*
"in-io": "null" disconnect stdin (read from /dev/null) "in_io": "null" disconnect stdin (read from /dev/null)
"in-io": "pipe" stdin is connected to the channel (default) "in_io": "pipe" stdin is connected to the channel (default)
"in-io": "file" stdin reads from a file "in_io": "file" stdin reads from a file
"in-io": "buffer" stdin reads from a buffer "in_io": "buffer" stdin reads from a buffer
"in-top": number when using "buffer": first line to send (default: 1) "in_top": number when using "buffer": first line to send (default: 1)
"in-bot": number when using "buffer": last line to send (default: last) "in_bot": number when using "buffer": last line to send (default: last)
"in-name": "/path/file" the name of the file or buffer to read from "in_name": "/path/file" the name of the file or buffer to read from
"in-buf": number the number of the buffer to read from "in_buf": number the number of the buffer to read from
*job-out-io* *out-name* *out-buf* *job-out_io* *out_name* *out_buf*
"out-io": "null" disconnect stdout (goes to /dev/null) "out_io": "null" disconnect stdout (goes to /dev/null)
"out-io": "pipe" stdout is connected to the channel (default) "out_io": "pipe" stdout is connected to the channel (default)
"out-io": "file" stdout writes to a file "out_io": "file" stdout writes to a file
"out-io": "buffer" stdout appends to a buffer "out_io": "buffer" stdout appends to a buffer
"out-name": "/path/file" the name of the file or buffer to write to "out_name": "/path/file" the name of the file or buffer to write to
"out-buf": number the number of the buffer to write to "out_buf": number the number of the buffer to write to
*job-err-io* *err-name* *err-buf* *job-err_io* *err_name* *err_buf*
"err-io": "out" stderr messages to go to stdout "err_io": "out" stderr messages to go to stdout
"err-io": "null" disconnect stderr (goes to /dev/null) "err_io": "null" disconnect stderr (goes to /dev/null)
"err-io": "pipe" stderr is connected to the channel (default) "err_io": "pipe" stderr is connected to the channel (default)
"err-io": "file" stderr writes to a file "err_io": "file" stderr writes to a file
"err-io": "buffer" stderr appends to a buffer "err_io": "buffer" stderr appends to a buffer
"err-name": "/path/file" the name of the file or buffer to write to "err_name": "/path/file" the name of the file or buffer to write to
"err-buf": number the number of the buffer to write to "err_buf": number the number of the buffer to write to
Writing to a buffer ~ Writing to a buffer ~
When the out-io or err-io mode is "buffer" and there is a callback, the text When the out_io or err_io mode is "buffer" and there is a callback, the text
is appended to the buffer before invoking the callback. is appended to the buffer before invoking the callback.
When a buffer is used both for input and output, the output lines are put When a buffer is used both for input and output, the output lines are put
@@ -614,7 +614,7 @@ Undo is synced for every added line.
Writing to a file ~ Writing to a file ~
*E920*
The file is created with permissions 600 (read-write for the user, not The file is created with permissions 600 (read-write for the user, not
accessible for others). Use |setfperm()| to change this. accessible for others). Use |setfperm()| to change this.

View File

@@ -3148,7 +3148,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
if (handle_mode(item, opt, &opt->jo_mode, JO_MODE) == FAIL) if (handle_mode(item, opt, &opt->jo_mode, JO_MODE) == FAIL)
return FAIL; return FAIL;
} }
else if (STRCMP(hi->hi_key, "in-mode") == 0) else if (STRCMP(hi->hi_key, "in_mode") == 0)
{ {
if (!(supported & JO_IN_MODE)) if (!(supported & JO_IN_MODE))
break; break;
@@ -3156,7 +3156,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
== FAIL) == FAIL)
return FAIL; return FAIL;
} }
else if (STRCMP(hi->hi_key, "out-mode") == 0) else if (STRCMP(hi->hi_key, "out_mode") == 0)
{ {
if (!(supported & JO_OUT_MODE)) if (!(supported & JO_OUT_MODE))
break; break;
@@ -3164,7 +3164,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
== FAIL) == FAIL)
return FAIL; return FAIL;
} }
else if (STRCMP(hi->hi_key, "err-mode") == 0) else if (STRCMP(hi->hi_key, "err_mode") == 0)
{ {
if (!(supported & JO_ERR_MODE)) if (!(supported & JO_ERR_MODE))
break; break;
@@ -3172,18 +3172,18 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
== FAIL) == FAIL)
return FAIL; return FAIL;
} }
else if (STRCMP(hi->hi_key, "in-io") == 0 else if (STRCMP(hi->hi_key, "in_io") == 0
|| STRCMP(hi->hi_key, "out-io") == 0 || STRCMP(hi->hi_key, "out_io") == 0
|| STRCMP(hi->hi_key, "err-io") == 0) || STRCMP(hi->hi_key, "err_io") == 0)
{ {
if (!(supported & JO_OUT_IO)) if (!(supported & JO_OUT_IO))
break; break;
if (handle_io(item, part_from_char(*hi->hi_key), opt) == FAIL) if (handle_io(item, part_from_char(*hi->hi_key), opt) == FAIL)
return FAIL; return FAIL;
} }
else if (STRCMP(hi->hi_key, "in-name") == 0 else if (STRCMP(hi->hi_key, "in_name") == 0
|| STRCMP(hi->hi_key, "out-name") == 0 || STRCMP(hi->hi_key, "out_name") == 0
|| STRCMP(hi->hi_key, "err-name") == 0) || STRCMP(hi->hi_key, "err_name") == 0)
{ {
part = part_from_char(*hi->hi_key); part = part_from_char(*hi->hi_key);
@@ -3193,9 +3193,9 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_io_name[part] = opt->jo_io_name[part] =
get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]); get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]);
} }
else if (STRCMP(hi->hi_key, "in-buf") == 0 else if (STRCMP(hi->hi_key, "in_buf") == 0
|| STRCMP(hi->hi_key, "out-buf") == 0 || STRCMP(hi->hi_key, "out_buf") == 0
|| STRCMP(hi->hi_key, "err-buf") == 0) || STRCMP(hi->hi_key, "err_buf") == 0)
{ {
part = part_from_char(*hi->hi_key); part = part_from_char(*hi->hi_key);
@@ -3214,8 +3214,8 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
return FAIL; return FAIL;
} }
} }
else if (STRCMP(hi->hi_key, "in-top") == 0 else if (STRCMP(hi->hi_key, "in_top") == 0
|| STRCMP(hi->hi_key, "in-bot") == 0) || STRCMP(hi->hi_key, "in_bot") == 0)
{ {
linenr_T *lp; linenr_T *lp;
@@ -3262,7 +3262,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
return FAIL; return FAIL;
} }
} }
else if (STRCMP(hi->hi_key, "out-cb") == 0) else if (STRCMP(hi->hi_key, "out_cb") == 0)
{ {
if (!(supported & JO_OUT_CALLBACK)) if (!(supported & JO_OUT_CALLBACK))
break; break;
@@ -3270,11 +3270,11 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_out_cb = get_callback(item, &opt->jo_out_partial); opt->jo_out_cb = get_callback(item, &opt->jo_out_partial);
if (opt->jo_out_cb == NULL) if (opt->jo_out_cb == NULL)
{ {
EMSG2(_(e_invarg2), "out-cb"); EMSG2(_(e_invarg2), "out_cb");
return FAIL; return FAIL;
} }
} }
else if (STRCMP(hi->hi_key, "err-cb") == 0) else if (STRCMP(hi->hi_key, "err_cb") == 0)
{ {
if (!(supported & JO_ERR_CALLBACK)) if (!(supported & JO_ERR_CALLBACK))
break; break;
@@ -3282,11 +3282,11 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_err_cb = get_callback(item, &opt->jo_err_partial); opt->jo_err_cb = get_callback(item, &opt->jo_err_partial);
if (opt->jo_err_cb == NULL) if (opt->jo_err_cb == NULL)
{ {
EMSG2(_(e_invarg2), "err-cb"); EMSG2(_(e_invarg2), "err_cb");
return FAIL; return FAIL;
} }
} }
else if (STRCMP(hi->hi_key, "close-cb") == 0) else if (STRCMP(hi->hi_key, "close_cb") == 0)
{ {
if (!(supported & JO_CLOSE_CALLBACK)) if (!(supported & JO_CLOSE_CALLBACK))
break; break;
@@ -3294,7 +3294,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_close_cb = get_callback(item, &opt->jo_close_partial); opt->jo_close_cb = get_callback(item, &opt->jo_close_partial);
if (opt->jo_close_cb == NULL) if (opt->jo_close_cb == NULL)
{ {
EMSG2(_(e_invarg2), "close-cb"); EMSG2(_(e_invarg2), "close_cb");
return FAIL; return FAIL;
} }
} }
@@ -3312,14 +3312,14 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_set |= JO_TIMEOUT; opt->jo_set |= JO_TIMEOUT;
opt->jo_timeout = get_tv_number(item); opt->jo_timeout = get_tv_number(item);
} }
else if (STRCMP(hi->hi_key, "out-timeout") == 0) else if (STRCMP(hi->hi_key, "out_timeout") == 0)
{ {
if (!(supported & JO_OUT_TIMEOUT)) if (!(supported & JO_OUT_TIMEOUT))
break; break;
opt->jo_set |= JO_OUT_TIMEOUT; opt->jo_set |= JO_OUT_TIMEOUT;
opt->jo_out_timeout = get_tv_number(item); opt->jo_out_timeout = get_tv_number(item);
} }
else if (STRCMP(hi->hi_key, "err-timeout") == 0) else if (STRCMP(hi->hi_key, "err_timeout") == 0)
{ {
if (!(supported & JO_ERR_TIMEOUT)) if (!(supported & JO_ERR_TIMEOUT))
break; break;
@@ -3360,7 +3360,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
return FAIL; return FAIL;
} }
} }
else if (STRCMP(hi->hi_key, "exit-cb") == 0) else if (STRCMP(hi->hi_key, "exit_cb") == 0)
{ {
if (!(supported & JO_EXIT_CB)) if (!(supported & JO_EXIT_CB))
break; break;
@@ -3375,7 +3375,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
item, opt->jo_ecb_buf); item, opt->jo_ecb_buf);
if (opt->jo_exit_cb == NULL) if (opt->jo_exit_cb == NULL)
{ {
EMSG2(_(e_invarg2), "exit-cb"); EMSG2(_(e_invarg2), "exit_cb");
return FAIL; return FAIL;
} }
} }
@@ -3546,7 +3546,7 @@ job_stop_on_exit()
} }
/* /*
* Called once in a while: check if any jobs with an "exit-cb" have ended. * Called once in a while: check if any jobs with an "exit_cb" have ended.
*/ */
void void
job_check_ended(void) job_check_ended(void)
@@ -3609,7 +3609,7 @@ job_start(typval_T *argvars)
&& (!(opt.jo_set & (JO_OUT_NAME << (part - PART_OUT))) && (!(opt.jo_set & (JO_OUT_NAME << (part - PART_OUT)))
|| *opt.jo_io_name[part] == NUL)) || *opt.jo_io_name[part] == NUL))
{ {
EMSG(_("E920: -io file requires -name to be set")); EMSG(_("E920: _io file requires _name to be set"));
return job; return job;
} }
@@ -3626,7 +3626,7 @@ job_start(typval_T *argvars)
} }
else if (!(opt.jo_set & JO_IN_NAME)) else if (!(opt.jo_set & JO_IN_NAME))
{ {
EMSG(_("E915: in-io buffer requires in-buf or in-name to be set")); EMSG(_("E915: in_io buffer requires in_buf or in_name to be set"));
} }
else else
buf = buflist_find_by_name(opt.jo_io_name[PART_IN], FALSE); buf = buflist_find_by_name(opt.jo_io_name[PART_IN], FALSE);
@@ -3837,7 +3837,7 @@ job_info(job_T *job, dict_T *dict)
dict_add_nr_str(dict, "process", nr, NULL); dict_add_nr_str(dict, "process", nr, NULL);
dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL); dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL);
dict_add_nr_str(dict, "exit-cb", 0L, job->jv_exit_cb); dict_add_nr_str(dict, "exit_cb", 0L, job->jv_exit_cb);
dict_add_nr_str(dict, "stoponexit", 0L, job->jv_stoponexit); dict_add_nr_str(dict, "stoponexit", 0L, job->jv_stoponexit);
} }

View File

@@ -1414,18 +1414,18 @@ struct channel_S {
#define JO_PART 0x1000 /* "part" */ #define JO_PART 0x1000 /* "part" */
#define JO_ID 0x2000 /* "id" */ #define JO_ID 0x2000 /* "id" */
#define JO_STOPONEXIT 0x4000 /* "stoponexit" */ #define JO_STOPONEXIT 0x4000 /* "stoponexit" */
#define JO_EXIT_CB 0x8000 /* "exit-cb" */ #define JO_EXIT_CB 0x8000 /* "exit_cb" */
#define JO_OUT_IO 0x10000 /* "out-io" */ #define JO_OUT_IO 0x10000 /* "out_io" */
#define JO_ERR_IO 0x20000 /* "err-io" (JO_OUT_IO << 1) */ #define JO_ERR_IO 0x20000 /* "err_io" (JO_OUT_IO << 1) */
#define JO_IN_IO 0x40000 /* "in-io" (JO_OUT_IO << 2) */ #define JO_IN_IO 0x40000 /* "in_io" (JO_OUT_IO << 2) */
#define JO_OUT_NAME 0x80000 /* "out-name" */ #define JO_OUT_NAME 0x80000 /* "out_name" */
#define JO_ERR_NAME 0x100000 /* "err-name" (JO_OUT_NAME << 1) */ #define JO_ERR_NAME 0x100000 /* "err_name" (JO_OUT_NAME << 1) */
#define JO_IN_NAME 0x200000 /* "in-name" (JO_OUT_NAME << 2) */ #define JO_IN_NAME 0x200000 /* "in_name" (JO_OUT_NAME << 2) */
#define JO_IN_TOP 0x400000 /* "in-top" */ #define JO_IN_TOP 0x400000 /* "in_top" */
#define JO_IN_BOT 0x800000 /* "in-bot" */ #define JO_IN_BOT 0x800000 /* "in_bot" */
#define JO_OUT_BUF 0x1000000 /* "out-buf" */ #define JO_OUT_BUF 0x1000000 /* "out_buf" */
#define JO_ERR_BUF 0x2000000 /* "err-buf" (JO_OUT_BUF << 1) */ #define JO_ERR_BUF 0x2000000 /* "err_buf" (JO_OUT_BUF << 1) */
#define JO_IN_BUF 0x4000000 /* "in-buf" (JO_OUT_BUF << 2) */ #define JO_IN_BUF 0x4000000 /* "in_buf" (JO_OUT_BUF << 2) */
#define JO_CHANNEL 0x8000000 /* "channel" */ #define JO_CHANNEL 0x8000000 /* "channel" */
#define JO_ALL 0xfffffff #define JO_ALL 0xfffffff

View File

@@ -519,7 +519,7 @@ func Test_nl_err_to_out_pipe()
endif endif
call ch_logfile('Xlog') call ch_logfile('Xlog')
call ch_log('Test_nl_err_to_out_pipe()') call ch_log('Test_nl_err_to_out_pipe()')
let job = job_start(s:python . " test_channel_pipe.py", {'err-io': 'out'}) let job = job_start(s:python . " test_channel_pipe.py", {'err_io': 'out'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -566,7 +566,7 @@ func Test_nl_read_file()
call ch_log('Test_nl_read_file()') call ch_log('Test_nl_read_file()')
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput') call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'in-io': 'file', 'in-name': 'Xinput'}) \ {'in_io': 'file', 'in_name': 'Xinput'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -586,7 +586,7 @@ func Test_nl_write_out_file()
endif endif
call ch_log('Test_nl_write_out_file()') call ch_log('Test_nl_write_out_file()')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'out-io': 'file', 'out-name': 'Xoutput'}) \ {'out_io': 'file', 'out_name': 'Xoutput'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -607,7 +607,7 @@ func Test_nl_write_err_file()
endif endif
call ch_log('Test_nl_write_err_file()') call ch_log('Test_nl_write_err_file()')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'err-io': 'file', 'err-name': 'Xoutput'}) \ {'err_io': 'file', 'err_name': 'Xoutput'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -628,7 +628,7 @@ func Test_nl_write_both_file()
endif endif
call ch_log('Test_nl_write_both_file()') call ch_log('Test_nl_write_both_file()')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'out-io': 'file', 'out-name': 'Xoutput', 'err-io': 'out'}) \ {'out_io': 'file', 'out_name': 'Xoutput', 'err_io': 'out'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -649,13 +649,13 @@ func Run_test_pipe_to_buffer(use_name)
return return
endif endif
call ch_log('Test_pipe_to_buffer()') call ch_log('Test_pipe_to_buffer()')
let options = {'out-io': 'buffer'} let options = {'out_io': 'buffer'}
if a:use_name if a:use_name
let options['out-name'] = 'pipe-output' let options['out_name'] = 'pipe-output'
let firstline = 'Reading from channel output...' let firstline = 'Reading from channel output...'
else else
sp pipe-output sp pipe-output
let options['out-buf'] = bufnr('%') let options['out_buf'] = bufnr('%')
quit quit
let firstline = '' let firstline = ''
endif endif
@@ -689,13 +689,13 @@ func Run_test_pipe_err_to_buffer(use_name)
return return
endif endif
call ch_log('Test_pipe_err_to_buffer()') call ch_log('Test_pipe_err_to_buffer()')
let options = {'err-io': 'buffer'} let options = {'err_io': 'buffer'}
if a:use_name if a:use_name
let options['err-name'] = 'pipe-err' let options['err_name'] = 'pipe-err'
let firstline = 'Reading from channel error...' let firstline = 'Reading from channel error...'
else else
sp pipe-err sp pipe-err
let options['err-buf'] = bufnr('%') let options['err_buf'] = bufnr('%')
quit quit
let firstline = '' let firstline = ''
endif endif
@@ -730,7 +730,7 @@ func Test_pipe_both_to_buffer()
endif endif
call ch_log('Test_pipe_both_to_buffer()') call ch_log('Test_pipe_both_to_buffer()')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'out-io': 'buffer', 'out-name': 'pipe-err', 'err-io': 'out'}) \ {'out_io': 'buffer', 'out_name': 'pipe-err', 'err_io': 'out'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -756,11 +756,11 @@ func Run_test_pipe_from_buffer(use_name)
sp pipe-input sp pipe-input
call setline(1, ['echo one', 'echo two', 'echo three']) call setline(1, ['echo one', 'echo two', 'echo three'])
let options = {'in-io': 'buffer'} let options = {'in_io': 'buffer'}
if a:use_name if a:use_name
let options['in-name'] = 'pipe-input' let options['in_name'] = 'pipe-input'
else else
let options['in-buf'] = bufnr('%') let options['in_buf'] = bufnr('%')
endif endif
let job = job_start(s:python . " test_channel_pipe.py", options) let job = job_start(s:python . " test_channel_pipe.py", options)
@@ -790,7 +790,7 @@ func Test_pipe_to_nameless_buffer()
endif endif
call ch_log('Test_pipe_to_nameless_buffer()') call ch_log('Test_pipe_to_nameless_buffer()')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'out-io': 'buffer'}) \ {'out_io': 'buffer'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -811,7 +811,7 @@ func Test_pipe_to_buffer_json()
endif endif
call ch_log('Test_pipe_to_buffer_json()') call ch_log('Test_pipe_to_buffer_json()')
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'out-io': 'buffer', 'out-mode': 'json'}) \ {'out_io': 'buffer', 'out_mode': 'json'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
let handle = job_getchannel(job) let handle = job_getchannel(job)
@@ -849,8 +849,8 @@ func Test_pipe_io_two_buffers()
set buftype=nofile set buftype=nofile
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'in-io': 'buffer', 'in-name': 'pipe-input', 'in-top': 0, \ {'in_io': 'buffer', 'in_name': 'pipe-input', 'in_top': 0,
\ 'out-io': 'buffer', 'out-name': 'pipe-output'}) \ 'out_io': 'buffer', 'out_name': 'pipe-output'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
exe "normal Gaecho hello\<CR>" exe "normal Gaecho hello\<CR>"
@@ -884,8 +884,8 @@ func Test_pipe_io_one_buffer()
set buftype=nofile set buftype=nofile
let job = job_start(s:python . " test_channel_pipe.py", let job = job_start(s:python . " test_channel_pipe.py",
\ {'in-io': 'buffer', 'in-name': 'pipe-io', 'in-top': 0, \ {'in_io': 'buffer', 'in_name': 'pipe-io', 'in_top': 0,
\ 'out-io': 'buffer', 'out-name': 'pipe-io'}) \ 'out_io': 'buffer', 'out_name': 'pipe-io'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
exe "normal Goecho hello\<CR>" exe "normal Goecho hello\<CR>"
@@ -912,7 +912,7 @@ func Test_pipe_null()
" We cannot check that no I/O works, we only check that the job starts " We cannot check that no I/O works, we only check that the job starts
" properly. " properly.
let job = job_start(s:python . " test_channel_pipe.py something", let job = job_start(s:python . " test_channel_pipe.py something",
\ {'in-io': 'null'}) \ {'in_io': 'null'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
call assert_equal('something', ch_read(job)) call assert_equal('something', ch_read(job))
@@ -921,7 +921,7 @@ func Test_pipe_null()
endtry endtry
let job = job_start(s:python . " test_channel_pipe.py err-out", let job = job_start(s:python . " test_channel_pipe.py err-out",
\ {'out-io': 'null'}) \ {'out_io': 'null'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
call assert_equal('err-out', ch_read(job, {"part": "err"})) call assert_equal('err-out', ch_read(job, {"part": "err"}))
@@ -930,7 +930,7 @@ func Test_pipe_null()
endtry endtry
let job = job_start(s:python . " test_channel_pipe.py something", let job = job_start(s:python . " test_channel_pipe.py something",
\ {'err-io': 'null'}) \ {'err_io': 'null'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
try try
call assert_equal('something', ch_read(job)) call assert_equal('something', ch_read(job))
@@ -939,12 +939,12 @@ func Test_pipe_null()
endtry endtry
let job = job_start(s:python . " test_channel_pipe.py something", let job = job_start(s:python . " test_channel_pipe.py something",
\ {'out-io': 'null', 'err-io': 'out'}) \ {'out_io': 'null', 'err_io': 'out'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
call job_stop(job) call job_stop(job)
let job = job_start(s:python . " test_channel_pipe.py something", let job = job_start(s:python . " test_channel_pipe.py something",
\ {'in-io': 'null', 'out-io': 'null', 'err-io': 'null'}) \ {'in_io': 'null', 'out_io': 'null', 'err_io': 'null'})
call assert_equal("run", job_status(job)) call assert_equal("run", job_status(job))
call assert_equal('channel fail', string(job_getchannel(job))) call assert_equal('channel fail', string(job_getchannel(job)))
call assert_equal('fail', ch_status(job)) call assert_equal('fail', ch_status(job))
@@ -1082,9 +1082,9 @@ function MyExitCb(job, status)
endfunc endfunc
function s:test_exit_callback(port) function s:test_exit_callback(port)
call job_setoptions(s:job, {'exit-cb': 'MyExitCb'}) call job_setoptions(s:job, {'exit_cb': 'MyExitCb'})
let s:exit_job = s:job let s:exit_job = s:job
call assert_equal('MyExitCb', job_info(s:job)['exit-cb']) call assert_equal('MyExitCb', job_info(s:job)['exit_cb'])
endfunc endfunc
func Test_exit_callback() func Test_exit_callback()
@@ -1121,7 +1121,7 @@ function s:test_close_callback(port)
call assert_false(1, "Can't open channel") call assert_false(1, "Can't open channel")
return return
endif endif
call ch_setoptions(handle, {'close-cb': 'MyCloseCb'}) call ch_setoptions(handle, {'close_cb': 'MyCloseCb'})
call assert_equal('', ch_evalexpr(handle, 'close me')) call assert_equal('', ch_evalexpr(handle, 'close me'))
call s:waitFor('"closed" == s:ch_close_ret') call s:waitFor('"closed" == s:ch_close_ret')

View File

@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1560,
/**/ /**/
1559, 1559,
/**/ /**/