Mercurial > vim
diff src/os_win32.c @ 8430:800423dbc260 v7.4.1506
commit https://github.com/vim/vim/commit/b69fccf377f43544b86817b0de6cc1498a4ff9ec
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 6 23:06:25 2016 +0100
patch 7.4.1506
Problem: Job cannot read from a file.
Solution: Implement reading from a file for Unix.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 06 Mar 2016 23:15:05 +0100 |
parents | 3b9a306724ec |
children | 6c421014a0b3 |
line wrap: on
line diff
--- a/src/os_win32.c +++ b/src/os_win32.c @@ -5000,6 +5000,7 @@ mch_start_job(char *cmd, job_T *job, job 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, job 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];