mirror of
https://github.com/vim/vim.git
synced 2025-11-12 22:44:34 -05:00
patch 8.0.0855: MS-Windows: can't get tty name of terminal
Problem: MS-Windows: can't get tty name of terminal. Solution: Use the winpty process number. (Yasuhiro Matsumoto, closes #1929)
This commit is contained in:
@@ -2201,6 +2201,7 @@ void (*winpty_spawn_config_free)(void*);
|
|||||||
void (*winpty_error_free)(void*);
|
void (*winpty_error_free)(void*);
|
||||||
LPCWSTR (*winpty_error_msg)(void*);
|
LPCWSTR (*winpty_error_msg)(void*);
|
||||||
BOOL (*winpty_set_size)(void*, int, int, void*);
|
BOOL (*winpty_set_size)(void*, int, int, void*);
|
||||||
|
HANDLE (*winpty_agent_process)(void*);
|
||||||
|
|
||||||
#define WINPTY_DLL "winpty.dll"
|
#define WINPTY_DLL "winpty.dll"
|
||||||
|
|
||||||
@@ -2230,6 +2231,7 @@ dyn_winpty_init(void)
|
|||||||
{"winpty_spawn_config_new", (FARPROC*)&winpty_spawn_config_new},
|
{"winpty_spawn_config_new", (FARPROC*)&winpty_spawn_config_new},
|
||||||
{"winpty_error_msg", (FARPROC*)&winpty_error_msg},
|
{"winpty_error_msg", (FARPROC*)&winpty_error_msg},
|
||||||
{"winpty_set_size", (FARPROC*)&winpty_set_size},
|
{"winpty_set_size", (FARPROC*)&winpty_set_size},
|
||||||
|
{"winpty_agent_process", (FARPROC*)&winpty_agent_process},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2272,6 +2274,7 @@ term_and_job_init(term_T *term, int rows, int cols, char_u *cmd, jobopt_T *opt)
|
|||||||
HANDLE jo = NULL, child_process_handle, child_thread_handle;
|
HANDLE jo = NULL, child_process_handle, child_thread_handle;
|
||||||
void *winpty_err;
|
void *winpty_err;
|
||||||
void *spawn_config = NULL;
|
void *spawn_config = NULL;
|
||||||
|
char buf[MAX_PATH];
|
||||||
|
|
||||||
if (!dyn_winpty_init())
|
if (!dyn_winpty_init())
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@@ -2358,6 +2361,9 @@ term_and_job_init(term_T *term, int rows, int cols, char_u *cmd, jobopt_T *opt)
|
|||||||
job->jv_proc_info.dwProcessId = GetProcessId(child_process_handle);
|
job->jv_proc_info.dwProcessId = GetProcessId(child_process_handle);
|
||||||
job->jv_job_object = jo;
|
job->jv_job_object = jo;
|
||||||
job->jv_status = JOB_STARTED;
|
job->jv_status = JOB_STARTED;
|
||||||
|
sprintf(buf, "winpty://%lu",
|
||||||
|
GetProcessId(winpty_agent_process(term->tl_winpty)));
|
||||||
|
job->jv_tty_name = vim_strsave((char_u*)buf);
|
||||||
++job->jv_refcount;
|
++job->jv_refcount;
|
||||||
term->tl_job = job;
|
term->tl_job = job;
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ func Test_terminal_basic()
|
|||||||
call assert_match("^/dev/", job_info(g:job).tty)
|
call assert_match("^/dev/", job_info(g:job).tty)
|
||||||
call assert_match("^/dev/", term_gettty(''))
|
call assert_match("^/dev/", term_gettty(''))
|
||||||
else
|
else
|
||||||
call assert_equal("", job_info(g:job).tty)
|
call assert_match("^winpty://", job_info(g:job).tty)
|
||||||
|
call assert_match("^winpty://", term_gettty(''))
|
||||||
endif
|
endif
|
||||||
call Stop_shell_in_terminal(buf)
|
call Stop_shell_in_terminal(buf)
|
||||||
call term_wait(buf)
|
call term_wait(buf)
|
||||||
|
|||||||
@@ -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 */
|
||||||
|
/**/
|
||||||
|
855,
|
||||||
/**/
|
/**/
|
||||||
854,
|
854,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user