diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-14 19:13:43 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-14 19:13:43 +0100 |
commit | 7b3ca76a451b10d238ef946f3231762e0bd988e9 (patch) | |
tree | d05c9be4dafb1e5ae77eb76325df7cc40fda2e52 /src/os_win32.c | |
parent | 0727d362b4dad83d9fdf1caba074213e77e0aa49 (diff) | |
download | vim-git-7b3ca76a451b10d238ef946f3231762e0bd988e9.tar.gz |
patch 7.4.1318v7.4.1318
Problem: Channel with pipes doesn't work in GUI.
Solution: Register input handlers for pipes.
Diffstat (limited to 'src/os_win32.c')
-rw-r--r-- | src/os_win32.c | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index cc5fc3dee..55d8e6ba1 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -5039,12 +5039,19 @@ mch_start_job(char *cmd, job_T *job) STARTUPINFO si; PROCESS_INFORMATION pi; HANDLE jo; +#ifdef FEAT_CHANNEL + channel_T *channel; + + channel = add_channel(); + if (channel == NULL) + return; +#endif jo = CreateJobObject(NULL, NULL); if (jo == NULL) { job->jv_status = JOB_FAILED; - return; + goto failed; } ZeroMemory(&pi, sizeof(pi)); @@ -5062,22 +5069,40 @@ mch_start_job(char *cmd, job_T *job) { CloseHandle(jo); job->jv_status = JOB_FAILED; + goto failed; } - else + + if (!AssignProcessToJobObject(jo, pi.hProcess)) { - if (!AssignProcessToJobObject(jo, pi.hProcess)) - { - /* if failing, switch the way to terminate - * process with TerminateProcess. */ - CloseHandle(jo); - jo = NULL; - } - ResumeThread(pi.hThread); - CloseHandle(job->jv_proc_info.hThread); - job->jv_proc_info = pi; - job->jv_job_object = jo; - job->jv_status = JOB_STARTED; + /* if failing, switch the way to terminate + * process with TerminateProcess. */ + CloseHandle(jo); + jo = NULL; } + ResumeThread(pi.hThread); + CloseHandle(job->jv_proc_info.hThread); + job->jv_proc_info = pi; + job->jv_job_object = jo; + job->jv_status = JOB_STARTED; + +#ifdef FEAT_CHANNEL +# if 0 + /* TODO: connect stdin/stdout/stderr */ + job->jv_channel = channel; + channel_set_pipes(channel, fd_in[1], fd_out[0], fd_err[0]); + channel_set_job(channel, job); + +# ifdef FEAT_GUI + channel_gui_register(channel); +# endif +# endif +#endif + return; + +failed: +#ifdef FEAT_CHANNEL + channel_free(channel); +#endif } char * |