Mercurial > vim
diff src/os_win32.c @ 8047:7c74cafac0a1 v7.4.1318
commit https://github.com/vim/vim/commit/7b3ca76a451b10d238ef946f3231762e0bd988e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 14 19:13:43 2016 +0100
patch 7.4.1318
Problem: Channel with pipes doesn't work in GUI.
Solution: Register input handlers for pipes.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 14 Feb 2016 19:15:09 +0100 |
parents | 75e0831549f1 |
children | 15253130abd8 |
line wrap: on
line diff
--- 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; - } - else - { - 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; - } + goto failed; + } + + 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; + +#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 *