diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-06 23:06:25 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-06 23:06:25 +0100 |
commit | b69fccf377f43544b86817b0de6cc1498a4ff9ec (patch) | |
tree | 16fe5187c9273a82f735ee1e4f2b50dcc345771f /src/os_win32.c | |
parent | d0b6502a7ace39d6cd30874110a572371d10beae (diff) | |
download | vim-git-b69fccf377f43544b86817b0de6cc1498a4ff9ec.tar.gz |
patch 7.4.1506v7.4.1506
Problem: Job cannot read from a file.
Solution: Implement reading from a file for Unix.
Diffstat (limited to 'src/os_win32.c')
-rw-r--r-- | src/os_win32.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index 42e867246..9201b3497 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -5000,6 +5000,7 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) HANDLE jo; # ifdef FEAT_CHANNEL channel_T *channel; + int use_file_for_in = options->jo_io[PART_IN] == JIO_FILE; int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT; HANDLE ifd[2]; HANDLE ofd[2]; @@ -5035,13 +5036,25 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options) saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; - if (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0) - || !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0) - || !CreatePipe(&ofd[0], &ofd[1], &saAttr, 0) - || !pSetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0) - || (!use_out_for_err + if (use_file_for_in) + { + char_u *fname = options->jo_io_name[PART_IN]; + + // TODO + EMSG2(_(e_notopen), fname); + goto failed; + } + else if (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0) + || !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0)) + goto failed; + + if (!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0) + || !pSetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0)) + goto failed; + + if (!use_out_for_err && (!CreatePipe(&efd[0], &efd[1], &saAttr, 0) - || !pSetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0)))) + || !pSetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0))) goto failed; si.dwFlags |= STARTF_USESTDHANDLES; si.hStdInput = ifd[0]; |