Patch 7.4.1512
Problem: Channel input from file not supported on MS-Windows.
Solution: Implement it. (Yasuhiro Matsumoto)
Files: src/os_win32.c, src/testdir/test_channel.vim
*** ../vim-7.4.1511/src/os_win32.c 2016-03-06 23:06:20.671506716 +0100
--- src/os_win32.c 2016-03-08 13:47:23.024306736 +0100
***************
*** 5039,5048 ****
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))
--- 5039,5069 ----
if (use_file_for_in)
{
char_u *fname = options->jo_io_name[PART_IN];
! #ifdef FEAT_MBYTE
! WCHAR *wn = NULL;
! if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
! {
! wn = enc_to_utf16(fname, NULL);
! if (wn != NULL)
! {
! ifd[0] = CreateFileW(wn, GENERIC_WRITE, FILE_SHARE_READ,
! &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! vim_free(wn);
! if (ifd[0] == INVALID_HANDLE_VALUE
! && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
! wn = NULL;
! }
! }
! if (wn == NULL)
! #endif
!
! ifd[0] = CreateFile((LPCSTR)fname, GENERIC_READ, FILE_SHARE_READ,
! &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
! if (ifd[0] == INVALID_HANDLE_VALUE)
! {
! EMSG2(_(e_notopen), fname);
! goto failed;
! }
}
else if (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
|| !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0))
***************
*** 5088,5105 ****
job->jv_status = JOB_STARTED;
# ifdef FEAT_CHANNEL
! CloseHandle(ifd[0]);
CloseHandle(ofd[1]);
if (!use_out_for_err)
CloseHandle(efd[1]);
job->jv_channel = channel;
! channel_set_pipes(channel, (sock_T)ifd[1], (sock_T)ofd[0],
! use_out_for_err ? INVALID_FD : (sock_T)efd[0]);
channel_set_job(channel, job, options);
! # ifdef FEAT_GUI
! channel_gui_register(channel);
! # endif
# endif
return;
--- 5109,5129 ----
job->jv_status = JOB_STARTED;
# ifdef FEAT_CHANNEL
! if (!use_file_for_in)
! CloseHandle(ifd[0]);
CloseHandle(ofd[1]);
if (!use_out_for_err)
CloseHandle(efd[1]);
job->jv_channel = channel;
! channel_set_pipes(channel,
! use_file_for_in ? INVALID_FD : (sock_T)ifd[1],
! (sock_T)ofd[0],
! use_out_for_err ? INVALID_FD : (sock_T)efd[0]);
channel_set_job(channel, job, options);
! # ifdef FEAT_GUI
! channel_gui_register(channel);
! # endif
# endif
return;
*** ../vim-7.4.1511/src/testdir/test_channel.vim 2016-03-07
22:26:24.666612809 +0100
--- src/testdir/test_channel.vim 2016-03-08 13:43:32.454709288 +0100
***************
*** 538,547 ****
if !has('job')
return
endif
- " TODO: make this work for MS-Windows.
- if !has('unix')
- return
- endif
call ch_log('Test_nl_read_file()')
call writefile(['echo something', 'echoerr wrong', 'double this'], 'Xinput')
let job = job_start(s:python . " test_channel_pipe.py",
--- 538,543 ----
*** ../vim-7.4.1511/src/version.c 2016-03-08 12:56:29.000024462 +0100
--- src/version.c 2016-03-08 13:47:39.272137449 +0100
***************
*** 745,746 ****
--- 745,748 ----
{ /* Add new patch number below this line */
+ /**/
+ 1512,
/**/
--
Everybody wants to go to heaven, but nobody wants to die.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.