comparison src/channel.c @ 11723:1922710ee8fa v8.0.0744

patch 8.0.0744: terminal window does not use a pty commit https://github.com/vim/vim/commit/5a1feb809191e236cadd2884a5f57ad26cd213a3 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 22 18:04:08 2017 +0200 patch 8.0.0744: terminal window does not use a pty Problem: A terminal window uses pipes instead of a pty. Solution: Add pty support.
author Christian Brabandt <cb@256bit.org>
date Sat, 22 Jul 2017 18:15:04 +0200
parents 13ecb3e64399
children cb1dc90d22cc
comparison
equal deleted inserted replaced
11722:68b9ac79648b 11723:1922710ee8fa
1011 if (*fd != INVALID_FD) 1011 if (*fd != INVALID_FD)
1012 { 1012 {
1013 if (part == PART_SOCK) 1013 if (part == PART_SOCK)
1014 sock_close(*fd); 1014 sock_close(*fd);
1015 else 1015 else
1016 fd_close(*fd); 1016 {
1017 /* When using a pty the same FD is set on multiple parts, only
1018 * close it when the last reference is closed. */
1019 if ((part == PART_IN || channel->ch_part[PART_IN].ch_fd != *fd)
1020 && (part == PART_OUT
1021 || channel->ch_part[PART_OUT].ch_fd != *fd)
1022 && (part == PART_ERR
1023 || channel->ch_part[PART_ERR].ch_fd != *fd))
1024 fd_close(*fd);
1025 }
1017 *fd = INVALID_FD; 1026 *fd = INVALID_FD;
1018 1027
1019 channel->ch_to_be_closed &= ~(1 << part); 1028 channel->ch_to_be_closed &= ~(1 << part);
1020 } 1029 }
1021 } 1030 }
4278 break; 4287 break;
4279 opt->jo_set |= JO_OUT_NAME << (part - PART_OUT); 4288 opt->jo_set |= JO_OUT_NAME << (part - PART_OUT);
4280 opt->jo_io_name[part] = 4289 opt->jo_io_name[part] =
4281 get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]); 4290 get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]);
4282 } 4291 }
4292 else if (STRCMP(hi->hi_key, "pty") == 0)
4293 {
4294 if (!(supported & JO_MODE))
4295 break;
4296 opt->jo_pty = get_tv_number(item);
4297 }
4283 else if (STRCMP(hi->hi_key, "in_buf") == 0 4298 else if (STRCMP(hi->hi_key, "in_buf") == 0
4284 || STRCMP(hi->hi_key, "out_buf") == 0 4299 || STRCMP(hi->hi_key, "out_buf") == 0
4285 || STRCMP(hi->hi_key, "err_buf") == 0) 4300 || STRCMP(hi->hi_key, "err_buf") == 0)
4286 { 4301 {
4287 part = part_from_char(*hi->hi_key); 4302 part = part_from_char(*hi->hi_key);
5072 ga_concat(&ga, (char_u *)argv[i]); 5087 ga_concat(&ga, (char_u *)argv[i]);
5073 } 5088 }
5074 ch_logs(NULL, "Starting job: %s", (char *)ga.ga_data); 5089 ch_logs(NULL, "Starting job: %s", (char *)ga.ga_data);
5075 ga_clear(&ga); 5090 ga_clear(&ga);
5076 } 5091 }
5077 mch_start_job(argv, job, &opt); 5092 mch_job_start(argv, job, &opt);
5078 #else 5093 #else
5079 ch_logs(NULL, "Starting job: %s", (char *)cmd); 5094 ch_logs(NULL, "Starting job: %s", (char *)cmd);
5080 mch_start_job((char *)cmd, job, &opt); 5095 mch_job_start((char *)cmd, job, &opt);
5081 #endif 5096 #endif
5082 5097
5083 /* If the channel is reading from a buffer, write lines now. */ 5098 /* If the channel is reading from a buffer, write lines now. */
5084 if (job->jv_channel != NULL) 5099 if (job->jv_channel != NULL)
5085 channel_write_in(job->jv_channel); 5100 channel_write_in(job->jv_channel);