Patch 8.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.
Files: src/testdir/test_terminal.vim, src/terminal.c
*** ../vim-8.0.1086/src/testdir/test_terminal.vim 2017-09-09
18:16:19.861806631 +0200
--- src/testdir/test_terminal.vim 2017-09-10 14:22:00.282841824 +0200
***************
*** 396,409 ****
endfunc
func Test_terminal_cwd()
! if !has('unix')
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))
exe buf . 'bwipe'
call delete('Xdir', 'rf')
--- 396,408 ----
endfunc
func Test_terminal_cwd()
! if !executable('pwd')
return
endif
call mkdir('Xdir')
let buf = term_start('pwd', {'cwd': 'Xdir'})
! call WaitFor('"Xdir" == fnamemodify(getline(1), ":t")')
! call assert_equal('Xdir', fnamemodify(getline(1), ":t"))
exe buf . 'bwipe'
call delete('Xdir', 'rf')
***************
*** 603,608 ****
--- 602,609 ----
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
*** ../vim-8.0.1086/src/terminal.c 2017-09-09 16:34:28.867014115 +0200
--- src/terminal.c 2017-09-10 14:11:20.230954113 +0200
***************
*** 38,45 ****
* in tl_scrollback are no longer used.
*
* TODO:
- * - check for memory leaks
* - patch to use GUI or cterm colors for vterm. Yasuhiro, #2067
* - Redirecting output does not work on MS-Windows.
* - implement term_setsize()
* - add test for giving error for invalid 'termsize' value.
--- 38,48 ----
* in tl_scrollback are no longer used.
*
* TODO:
* - 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,3104 ****
--- 3102,3108 ----
jobopt_T *opt)
{
WCHAR *cmd_wchar = NULL;
+ WCHAR *cwd_wchar = NULL;
channel_T *channel = NULL;
job_T *job = NULL;
DWORD error;
***************
*** 3126,3131 ****
--- 3130,3137 ----
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,3158 ****
WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN,
NULL,
cmd_wchar,
! NULL,
NULL,
&winpty_err);
if (spawn_config == NULL)
--- 3158,3164 ----
WINPTY_SPAWN_FLAG_EXIT_AFTER_SHUTDOWN,
NULL,
cmd_wchar,
! cwd_wchar,
NULL,
&winpty_err);
if (spawn_config == NULL)
***************
*** 3203,3208 ****
--- 3209,3215 ----
winpty_spawn_config_free(spawn_config);
vim_free(cmd_wchar);
+ vim_free(cwd_wchar);
create_vterm(term, term->tl_rows, term->tl_cols);
***************
*** 3226,3233 ****
failed:
if (argvar->v_type == VAR_LIST)
vim_free(ga.ga_data);
! if (cmd_wchar != NULL)
! vim_free(cmd_wchar);
if (spawn_config != NULL)
winpty_spawn_config_free(spawn_config);
if (channel != NULL)
--- 3233,3240 ----
failed:
if (argvar->v_type == VAR_LIST)
vim_free(ga.ga_data);
! vim_free(cmd_wchar);
! vim_free(cwd_wchar);
if (spawn_config != NULL)
winpty_spawn_config_free(spawn_config);
if (channel != NULL)
*** ../vim-8.0.1086/src/version.c 2017-09-09 23:00:49.381581228 +0200
--- src/version.c 2017-09-10 13:36:50.240219709 +0200
***************
*** 771,772 ****
--- 771,774 ----
{ /* Add new patch number below this line */
+ /**/
+ 1087,
/**/
--
>From "know your smileys":
:-| :-| Deja' vu!
/// 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.