summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-07-22 18:04:08 +0200
committerBram Moolenaar <Bram@vim.org>2017-07-22 18:04:08 +0200
commit5a1feb809191e236cadd2884a5f57ad26cd213a3 (patch)
treeeabc8216a80701318a5b7a9596bc11d69c224c9b /src/channel.c
parent825680f5f4ffed5d57fdb283dde5f0ad734605fc (diff)
downloadvim-git-5a1feb809191e236cadd2884a5f57ad26cd213a3.tar.gz
patch 8.0.0744: terminal window does not use a ptyv8.0.0744
Problem: A terminal window uses pipes instead of a pty. Solution: Add pty support.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/channel.c b/src/channel.c
index 141bc5f37..7af19b041 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1013,7 +1013,16 @@ ch_close_part(channel_T *channel, ch_part_T part)
if (part == PART_SOCK)
sock_close(*fd);
else
- fd_close(*fd);
+ {
+ /* When using a pty the same FD is set on multiple parts, only
+ * close it when the last reference is closed. */
+ if ((part == PART_IN || channel->ch_part[PART_IN].ch_fd != *fd)
+ && (part == PART_OUT
+ || channel->ch_part[PART_OUT].ch_fd != *fd)
+ && (part == PART_ERR
+ || channel->ch_part[PART_ERR].ch_fd != *fd))
+ fd_close(*fd);
+ }
*fd = INVALID_FD;
channel->ch_to_be_closed &= ~(1 << part);
@@ -4280,6 +4289,12 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported)
opt->jo_io_name[part] =
get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]);
}
+ else if (STRCMP(hi->hi_key, "pty") == 0)
+ {
+ if (!(supported & JO_MODE))
+ break;
+ opt->jo_pty = get_tv_number(item);
+ }
else if (STRCMP(hi->hi_key, "in_buf") == 0
|| STRCMP(hi->hi_key, "out_buf") == 0
|| STRCMP(hi->hi_key, "err_buf") == 0)
@@ -5074,10 +5089,10 @@ job_start(typval_T *argvars, jobopt_T *opt_arg)
ch_logs(NULL, "Starting job: %s", (char *)ga.ga_data);
ga_clear(&ga);
}
- mch_start_job(argv, job, &opt);
+ mch_job_start(argv, job, &opt);
#else
ch_logs(NULL, "Starting job: %s", (char *)cmd);
- mch_start_job((char *)cmd, job, &opt);
+ mch_job_start((char *)cmd, job, &opt);
#endif
/* If the channel is reading from a buffer, write lines now. */