Mercurial > vim
diff src/os_unix.c @ 12192:6947d5bcf57f v8.0.0976
patch 8.0.0976: cannot send lines to a terminal job
commit https://github.com/vim/vim/commit/b241208a13d3e9def36d749b1e824ae694aa85f8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 20 18:09:14 2017 +0200
patch 8.0.0976: cannot send lines to a terminal job
Problem: Cannot send lines to a terminal job.
Solution: Make [range]terminal send selected lines to the job.
Use ++rows and ++cols for the terminal size.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 20 Aug 2017 18:15:04 +0200 |
parents | 3bf5fe164a9f |
children | 52eea5b73b2a |
line wrap: on
line diff
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -5238,6 +5238,7 @@ mch_job_start(char **argv, job_T *job, j int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE; int use_file_for_out = options->jo_io[PART_OUT] == JIO_FILE; int use_file_for_err = options->jo_io[PART_ERR] == JIO_FILE; + int use_buffer_for_in = options->jo_io[PART_IN] == JIO_BUFFER; int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT; SIGSET_DECL(curset) @@ -5247,7 +5248,10 @@ mch_job_start(char **argv, job_T *job, j /* default is to fail */ job->jv_status = JOB_FAILED; - if (options->jo_pty) + if (options->jo_pty + && (!(use_file_for_in || use_null_for_in) + || !(use_file_for_in || use_null_for_out) + || !(use_out_for_err || use_file_for_err || use_null_for_err))) open_pty(&pty_master_fd, &pty_slave_fd, &job->jv_tty_name); /* TODO: without the channel feature connect the child to /dev/null? */ @@ -5263,8 +5267,12 @@ mch_job_start(char **argv, job_T *job, j goto failed; } } - else if (!use_null_for_in && pty_master_fd < 0 && pipe(fd_in) < 0) - goto failed; + else + /* When writing buffer lines to the input don't use the pty, so that + * the pipe can be closed when all lines were written. */ + if (!use_null_for_in && (pty_master_fd < 0 || use_buffer_for_in) + && pipe(fd_in) < 0) + goto failed; if (use_file_for_out) {