comparison runtime/doc/channel.txt @ 10449:222b1432814e v8.0.0118

commit https://github.com/vim/vim/commit/5162822914372fc916a93f85848c0c82209e7cec Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 1 23:03:28 2016 +0100 patch 8.0.0118 Problem: "make proto" adds extra function prototype. Solution: Add #ifdef.
author Christian Brabandt <cb@256bit.org>
date Thu, 01 Dec 2016 23:15:04 +0100
parents acfc83aca8ee
children 883396809b45
comparison
equal deleted inserted replaced
10448:923e383fa291 10449:222b1432814e
1 *channel.txt* For Vim version 8.0. Last change: 2016 Nov 07 1 *channel.txt* For Vim version 8.0. Last change: 2016 Dec 01
2 2
3 3
4 VIM REFERENCE MANUAL by Bram Moolenaar 4 VIM REFERENCE MANUAL by Bram Moolenaar
5 5
6 6
478 Note that if the job exits before you read the output, the output may be lost. 478 Note that if the job exits before you read the output, the output may be lost.
479 This depends on the system (on Unix this happens because closing the write end 479 This depends on the system (on Unix this happens because closing the write end
480 of a pipe causes the read end to get EOF). To avoid this make the job sleep 480 of a pipe causes the read end to get EOF). To avoid this make the job sleep
481 for a short while before it exits. 481 for a short while before it exits.
482 482
483 Note that if the job exits before you read the output, the output may be lost.
484 This depends on the system (on Unix this happens because closing the write end
485 of a pipe causes the read end to get EOF). To avoid this make the job sleep
486 for a short while before it exits.
487
488 The handler defined for "out_cb" will not receive stderr. If you want to 483 The handler defined for "out_cb" will not receive stderr. If you want to
489 handle that separately, add an "err_cb" handler: > 484 handle that separately, add an "err_cb" handler: >
490 let job = job_start(command, {"out_cb": "MyHandler", 485 let job = job_start(command, {"out_cb": "MyHandler",
491 \ "err_cb": "ErrHandler"}) 486 \ "err_cb": "ErrHandler"})
492 487
547 ============================================================================== 542 ==============================================================================
548 9. Starting a job without a channel *job-start-nochannel* 543 9. Starting a job without a channel *job-start-nochannel*
549 544
550 To start another process without creating a channel: > 545 To start another process without creating a channel: >
551 let job = job_start(command, 546 let job = job_start(command,
552 \ {"in_io": "null", "out_io": "null", "err_io": "null"}) 547 \ {"in_io": "null", "out_io": "null", "err_io": "null"})
553 548
554 This starts {command} in the background, Vim does not wait for it to finish. 549 This starts {command} in the background, Vim does not wait for it to finish.
555 550
556 When Vim sees that neither stdin, stdout or stderr are connected, no channel 551 When Vim sees that neither stdin, stdout or stderr are connected, no channel
557 will be created. Often you will want to include redirection in the command to 552 will be created. Often you will want to include redirection in the command to
609 The two arguments are the channel and the message. 604 The two arguments are the channel and the message.
610 *job-close_cb* 605 *job-close_cb*
611 "close_cb": handler Callback for when the channel is closed. Same as 606 "close_cb": handler Callback for when the channel is closed. Same as
612 "close_cb" on |ch_open()|, see |close_cb|. 607 "close_cb" on |ch_open()|, see |close_cb|.
613 *job-exit_cb* 608 *job-exit_cb*
609 "drop" Specifies when to drop messages. Same as "drop" on
610 |ch_open()|, see |channel-drop|. For "auto" the
611 exit_cb is not considered.
612
614 "exit_cb": handler Callback for when the job ends. The arguments are the 613 "exit_cb": handler Callback for when the job ends. The arguments are the
615 job and the exit status. 614 job and the exit status.
616 Vim checks up to 10 times per second for jobs that 615 Vim checks up to 10 times per second for jobs that
617 ended. The check can also be triggered by calling 616 ended. The check can also be triggered by calling
618 |job_status()|, which may then invoke the exit_cb 617 |job_status()|, which may then invoke the exit_cb
642 NOTE: Not implemented yet! 641 NOTE: Not implemented yet!
643 642
644 "channel": {channel} Use an existing channel instead of creating a new one. 643 "channel": {channel} Use an existing channel instead of creating a new one.
645 The parts of the channel that get used for the new job 644 The parts of the channel that get used for the new job
646 will be disconnected from what they were used before. 645 will be disconnected from what they were used before.
647 If the channel was still use by another job this may 646 If the channel was still used by another job this may
648 cause I/O errors. 647 cause I/O errors.
649 Existing callbacks and other settings remain. 648 Existing callbacks and other settings remain.
650 649
651 *job-in_io* *in_top* *in_bot* *in_name* *in_buf* 650 *job-in_io* *in_top* *in_bot* *in_name* *in_buf*
652 "in_io": "null" disconnect stdin (read from /dev/null) 651 "in_io": "null" disconnect stdin (read from /dev/null)
660 659
661 *job-out_io* *out_name* *out_buf* 660 *job-out_io* *out_name* *out_buf*
662 "out_io": "null" disconnect stdout (goes to /dev/null) 661 "out_io": "null" disconnect stdout (goes to /dev/null)
663 "out_io": "pipe" stdout is connected to the channel (default) 662 "out_io": "pipe" stdout is connected to the channel (default)
664 "out_io": "file" stdout writes to a file 663 "out_io": "file" stdout writes to a file
665 "out_io": "buffer" stdout appends to a buffer (see below) 664 "out_io": "buffer" stdout appends to a buffer (see below)
666 "out_name": "/path/file" the name of the file or buffer to write to 665 "out_name": "/path/file" the name of the file or buffer to write to
667 "out_buf": number the number of the buffer to write to 666 "out_buf": number the number of the buffer to write to
668 "out_modifiable": 0 when writing to a buffer, 'modifiable' will be off 667 "out_modifiable": 0 when writing to a buffer, 'modifiable' will be off
669 (see below) 668 (see below)
670 "out_msg": 0 when writing to a new buffer, the first line will be 669 "out_msg": 0 when writing to a new buffer, the first line will be
673 *job-err_io* *err_name* *err_buf* 672 *job-err_io* *err_name* *err_buf*
674 "err_io": "out" stderr messages to go to stdout 673 "err_io": "out" stderr messages to go to stdout
675 "err_io": "null" disconnect stderr (goes to /dev/null) 674 "err_io": "null" disconnect stderr (goes to /dev/null)
676 "err_io": "pipe" stderr is connected to the channel (default) 675 "err_io": "pipe" stderr is connected to the channel (default)
677 "err_io": "file" stderr writes to a file 676 "err_io": "file" stderr writes to a file
678 "err_io": "buffer" stderr appends to a buffer (see below) 677 "err_io": "buffer" stderr appends to a buffer (see below)
679 "err_name": "/path/file" the name of the file or buffer to write to 678 "err_name": "/path/file" the name of the file or buffer to write to
680 "err_buf": number the number of the buffer to write to 679 "err_buf": number the number of the buffer to write to
681 "err_modifiable": 0 when writing to a buffer, 'modifiable' will be off 680 "err_modifiable": 0 when writing to a buffer, 'modifiable' will be off
682 (see below) 681 (see below)
683 "err_msg": 0 when writing to a new buffer, the first line will be 682 "err_msg": 0 when writing to a new buffer, the first line will be