summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-10 14:25:49 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-10 14:25:49 +0200
commite9f6fd27d0e2dcae3f4aa40c459d5e6a3b3dd102 (patch)
treeec6f2a7a7659ed8c40b0fdb9e3a7de7b30e426bf
parent8696bbaf52cca7c1fcbd5000c83406e462b7dbf4 (diff)
downloadvim-git-e9f6fd27d0e2dcae3f4aa40c459d5e6a3b3dd102.tar.gz
patch 8.0.1087: Test_terminal_cwd is flakyv8.0.1087
Problem: Test_terminal_cwd is flaky. MS-Windows: term_start() "cwd" argument does not work. Solution: Wait for the condition to be true instead of using a sleep. Pass the directory to winpty.
-rw-r--r--src/terminal.c15
-rw-r--r--src/testdir/test_terminal.vim9
-rw-r--r--src/version.c2
3 files changed, 18 insertions, 8 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 258f4f09d..391121d57 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -38,8 +38,11 @@
* in tl_scrollback are no longer used.
*
* TODO:
- * - check for memory leaks
* - patch to use GUI or cterm colors for vterm. Yasuhiro, #2067
+ * - when Normal background is not white or black, going to Terminal-Normal
+ * mode does not clear correctly. Use the terminal background color to erase
+ * the background.
+ * - patch to add tmap, jakalope (Jacob Askeland) #2073
* - Redirecting output does not work on MS-Windows.
* - implement term_setsize()
* - add test for giving error for invalid 'termsize' value.
@@ -3099,6 +3102,7 @@ term_and_job_init(
jobopt_T *opt)
{
WCHAR *cmd_wchar = NULL;
+ WCHAR *cwd_wchar = NULL;
channel_T *channel = NULL;
job_T *job = NULL;
DWORD error;
@@ -3126,6 +3130,8 @@ term_and_job_init(
cmd_wchar = enc_to_utf16(cmd, NULL);
if (cmd_wchar == NULL)
return FAIL;
+ if (opt->jo_cwd != NULL)
+ cwd_wchar = enc_to_utf16(opt->jo_cwd, NULL);
job = job_alloc();
if (job == NULL)
@@ -3152,7 +3158,7 @@ term_and_job_init(
WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN,
NULL,
cmd_wchar,
- NULL,
+ cwd_wchar,
NULL,
&winpty_err);
if (spawn_config == NULL)
@@ -3203,6 +3209,7 @@ term_and_job_init(
winpty_spawn_config_free(spawn_config);
vim_free(cmd_wchar);
+ vim_free(cwd_wchar);
create_vterm(term, term->tl_rows, term->tl_cols);
@@ -3226,8 +3233,8 @@ term_and_job_init(
failed:
if (argvar->v_type == VAR_LIST)
vim_free(ga.ga_data);
- if (cmd_wchar != NULL)
- vim_free(cmd_wchar);
+ vim_free(cmd_wchar);
+ vim_free(cwd_wchar);
if (spawn_config != NULL)
winpty_spawn_config_free(spawn_config);
if (channel != NULL)
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 738c3d4de..b4268f57b 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -396,14 +396,13 @@ func Test_finish_open_close()
endfunc
func Test_terminal_cwd()
- if !has('unix')
+ if !executable('pwd')
return
endif
call mkdir('Xdir')
let buf = term_start('pwd', {'cwd': 'Xdir'})
- sleep 100m
- call term_wait(buf)
- call assert_equal(getcwd() . '/Xdir', getline(1))
+ call WaitFor('"Xdir" == fnamemodify(getline(1), ":t")')
+ call assert_equal('Xdir', fnamemodify(getline(1), ":t"))
exe buf . 'bwipe'
call delete('Xdir', 'rf')
@@ -603,6 +602,8 @@ func Test_terminal_redir_file()
call term_wait(buf)
call WaitFor('len(readfile("Xfile")) > 0')
call assert_match('123', readfile('Xfile')[0])
+ let g:job = term_getjob(buf)
+ call WaitFor('job_status(g:job) == "dead"')
call delete('Xfile')
bwipe
endif
diff --git a/src/version.c b/src/version.c
index d20af56f2..12354ceef 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1087,
+/**/
1086,
/**/
1085,