0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.0.1240: MS-Windows: term_start() does not support environment

Problem:    MS-Windows: term_start() does not support environment.
Solution:   Implement the environment argument. (Yasuhiro Matsumoto, closes
            #2264)
This commit is contained in:
Bram Moolenaar
2017-10-30 21:56:23 +01:00
parent 48570488f1
commit ba6febd380
5 changed files with 40 additions and 14 deletions

View File

@@ -46,9 +46,18 @@
* - Redirecting output does not work on MS-Windows, Test_terminal_redir_file()
* is disabled.
* - cursor blinks in terminal on widows with a timer. (xtal8, #2142)
* - When closing gvim with an active terminal buffer, the dialog suggests
* saving the buffer. Should say something else. (Manas Thakur, #2215)
* Also: #2223
* - implement term_setsize()
* - Termdebug does not work when Vim build with mzscheme. gdb hangs.
* - Termdebug: issue #2154 might be avoided by adding -quiet to gdb?
* patch by Christian, 2017 Oct 23.
* - MS-Windows GUI: WinBar has tearoff item
* - MS-Windows GUI: still need to type a key after shell exits? #1924
* - What to store in a session file? Shell at the prompt would be OK to
* restore, but others may not. Open the window and let the user start the
* command?
* - add test for giving error for invalid 'termsize' value.
* - support minimal size when 'termsize' is "rows*cols".
* - support minimal size when 'termsize' is empty?
@@ -3390,6 +3399,7 @@ term_and_job_init(
{
WCHAR *cmd_wchar = NULL;
WCHAR *cwd_wchar = NULL;
WCHAR *env_wchar = NULL;
channel_T *channel = NULL;
job_T *job = NULL;
DWORD error;
@@ -3398,7 +3408,7 @@ term_and_job_init(
HANDLE child_thread_handle;
void *winpty_err;
void *spawn_config = NULL;
garray_T ga;
garray_T ga_cmd, ga_env;
char_u *cmd;
if (dyn_winpty_init(TRUE) == FAIL)
@@ -3408,10 +3418,10 @@ term_and_job_init(
cmd = argvar->vval.v_string;
else
{
ga_init2(&ga, (int)sizeof(char*), 20);
if (win32_build_cmd(argvar->vval.v_list, &ga) == FAIL)
ga_init2(&ga_cmd, (int)sizeof(char*), 20);
if (win32_build_cmd(argvar->vval.v_list, &ga_cmd) == FAIL)
goto failed;
cmd = ga.ga_data;
cmd = ga_cmd.ga_data;
}
cmd_wchar = enc_to_utf16(cmd, NULL);
@@ -3419,6 +3429,12 @@ term_and_job_init(
return FAIL;
if (opt->jo_cwd != NULL)
cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
if (opt->jo_env != NULL)
{
ga_init2(&ga_env, (int)sizeof(char*), 20);
win32_build_env(opt->jo_env, &ga_env);
env_wchar = ga_env.ga_data;
}
job = job_alloc();
if (job == NULL)
@@ -3446,7 +3462,7 @@ term_and_job_init(
NULL,
cmd_wchar,
cwd_wchar,
NULL,
env_wchar,
&winpty_err);
if (spawn_config == NULL)
goto failed;
@@ -3519,7 +3535,9 @@ term_and_job_init(
failed:
if (argvar->v_type == VAR_LIST)
vim_free(ga.ga_data);
vim_free(ga_cmd.ga_data);
if (opt->jo_env != NULL)
vim_free(ga_env.ga_data);
vim_free(cmd_wchar);
vim_free(cwd_wchar);
if (spawn_config != NULL)