Mercurial > vim
diff src/channel.c @ 11933:d033653d3df8 v8.0.0846
patch 8.0.0846: cannot get the name of the pty of a job
commit https://github.com/vim/vim/commit/7c9aec4ac86ccc455c0859d9393253141e3f77b6
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 3 13:51:25 2017 +0200
patch 8.0.0846: cannot get the name of the pty of a job
Problem: Cannot get the name of the pty of a job.
Solution: Add the "tty" entry to the job info. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/1920)
Add the term_gettty() function.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 03 Aug 2017 14:00:06 +0200 |
parents | 0cfe4a07c2ad |
children | c893d6c00497 |
line wrap: on
line diff
--- a/src/channel.c +++ b/src/channel.c @@ -1016,11 +1016,9 @@ ch_close_part(channel_T *channel, ch_par { /* 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)) + if ((part == PART_IN || channel->CH_IN_FD != *fd) + && (part == PART_OUT || channel->CH_OUT_FD != *fd) + && (part == PART_ERR || channel->CH_ERR_FD != *fd)) fd_close(*fd); } *fd = INVALID_FD; @@ -4592,6 +4590,7 @@ job_free_contents(job_T *job) } mch_clear_job(job); + vim_free(job->jv_tty_name); vim_free(job->jv_stoponexit); free_callback(job->jv_exit_cb, job->jv_exit_partial); } @@ -5164,6 +5163,8 @@ job_info(job_T *job, dict_T *dict) nr = job->jv_proc_info.dwProcessId; #endif dict_add_nr_str(dict, "process", nr, NULL); + dict_add_nr_str(dict, "tty", 0L, + job->jv_tty_name != NULL ? job->jv_tty_name : (char_u *)""); dict_add_nr_str(dict, "exitval", job->jv_exitval, NULL); dict_add_nr_str(dict, "exit_cb", 0L, job->jv_exit_cb);