forked from aniani/vim
patch 8.0.0977: cannot send lines to a terminal job on MS-Windows
Problem: Cannot send lines to a terminal job on MS-Windows. Solution: Set jv_in_buf. Command doesn't get EOF yet though.
This commit is contained in:
@@ -2869,11 +2869,13 @@ term_and_job_init(
|
|||||||
typval_T *argvar,
|
typval_T *argvar,
|
||||||
jobopt_T *opt)
|
jobopt_T *opt)
|
||||||
{
|
{
|
||||||
WCHAR *p = NULL;
|
WCHAR *cmd_wchar = NULL;
|
||||||
channel_T *channel = NULL;
|
channel_T *channel = NULL;
|
||||||
job_T *job = NULL;
|
job_T *job = NULL;
|
||||||
DWORD error;
|
DWORD error;
|
||||||
HANDLE jo = NULL, child_process_handle, child_thread_handle;
|
HANDLE jo = NULL;
|
||||||
|
HANDLE child_process_handle;
|
||||||
|
HANDLE child_thread_handle;
|
||||||
void *winpty_err;
|
void *winpty_err;
|
||||||
void *spawn_config = NULL;
|
void *spawn_config = NULL;
|
||||||
char buf[MAX_PATH];
|
char buf[MAX_PATH];
|
||||||
@@ -2893,8 +2895,8 @@ term_and_job_init(
|
|||||||
cmd = ga.ga_data;
|
cmd = ga.ga_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = enc_to_utf16(cmd, NULL);
|
cmd_wchar = enc_to_utf16(cmd, NULL);
|
||||||
if (p == NULL)
|
if (cmd_wchar == NULL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
|
||||||
job = job_alloc();
|
job = job_alloc();
|
||||||
@@ -2919,7 +2921,7 @@ term_and_job_init(
|
|||||||
WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN |
|
WINPTY_SPAWN_FLAG_AUTO_SHUTDOWN |
|
||||||
WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN,
|
WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN,
|
||||||
NULL,
|
NULL,
|
||||||
p,
|
cmd_wchar,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
&winpty_err);
|
&winpty_err);
|
||||||
@@ -2934,20 +2936,25 @@ term_and_job_init(
|
|||||||
if (job == NULL)
|
if (job == NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
|
/* TODO: when all lines are written and the fd is closed, the command
|
||||||
|
* doesn't get EOF and hangs. */
|
||||||
|
if (opt->jo_set & JO_IN_BUF)
|
||||||
|
job->jv_in_buf = buflist_findnr(opt->jo_io_buf[PART_IN]);
|
||||||
|
|
||||||
if (!winpty_spawn(term->tl_winpty, spawn_config, &child_process_handle,
|
if (!winpty_spawn(term->tl_winpty, spawn_config, &child_process_handle,
|
||||||
&child_thread_handle, &error, &winpty_err))
|
&child_thread_handle, &error, &winpty_err))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
channel_set_pipes(channel,
|
channel_set_pipes(channel,
|
||||||
(sock_T) CreateFileW(
|
(sock_T)CreateFileW(
|
||||||
winpty_conin_name(term->tl_winpty),
|
winpty_conin_name(term->tl_winpty),
|
||||||
GENERIC_WRITE, 0, NULL,
|
GENERIC_WRITE, 0, NULL,
|
||||||
OPEN_EXISTING, 0, NULL),
|
OPEN_EXISTING, 0, NULL),
|
||||||
(sock_T) CreateFileW(
|
(sock_T)CreateFileW(
|
||||||
winpty_conout_name(term->tl_winpty),
|
winpty_conout_name(term->tl_winpty),
|
||||||
GENERIC_READ, 0, NULL,
|
GENERIC_READ, 0, NULL,
|
||||||
OPEN_EXISTING, 0, NULL),
|
OPEN_EXISTING, 0, NULL),
|
||||||
(sock_T) CreateFileW(
|
(sock_T)CreateFileW(
|
||||||
winpty_conerr_name(term->tl_winpty),
|
winpty_conerr_name(term->tl_winpty),
|
||||||
GENERIC_READ, 0, NULL,
|
GENERIC_READ, 0, NULL,
|
||||||
OPEN_EXISTING, 0, NULL));
|
OPEN_EXISTING, 0, NULL));
|
||||||
@@ -2964,7 +2971,7 @@ term_and_job_init(
|
|||||||
}
|
}
|
||||||
|
|
||||||
winpty_spawn_config_free(spawn_config);
|
winpty_spawn_config_free(spawn_config);
|
||||||
vim_free(p);
|
vim_free(cmd_wchar);
|
||||||
|
|
||||||
create_vterm(term, rows, cols);
|
create_vterm(term, rows, cols);
|
||||||
|
|
||||||
@@ -2987,8 +2994,8 @@ term_and_job_init(
|
|||||||
failed:
|
failed:
|
||||||
if (argvar->v_type == VAR_LIST)
|
if (argvar->v_type == VAR_LIST)
|
||||||
vim_free(ga.ga_data);
|
vim_free(ga.ga_data);
|
||||||
if (p != NULL)
|
if (cmd_wchar != NULL)
|
||||||
vim_free(p);
|
vim_free(cmd_wchar);
|
||||||
if (spawn_config != NULL)
|
if (spawn_config != NULL)
|
||||||
winpty_spawn_config_free(spawn_config);
|
winpty_spawn_config_free(spawn_config);
|
||||||
if (channel != NULL)
|
if (channel != NULL)
|
||||||
|
@@ -769,6 +769,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
977,
|
||||||
/**/
|
/**/
|
||||||
976,
|
976,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user