Patch 8.1.2255
Problem: ":term ++shell" does not work on MS-Windows.
Solution: Add MS-Windows support.
Files: src/terminal.c, src/testdir/test_terminal.vim
*** ../vim-8.1.2254/src/terminal.c 2019-11-03 23:37:08.288934381 +0100
--- src/terminal.c 2019-11-03 23:44:31.294556861 +0100
***************
*** 846,866 ****
term_start(NULL, argv, &opt, eap->forceit ? TERM_START_FORCEIT : 0);
vim_free(tofree1);
vim_free(tofree2);
#else
emsg(_("E279: Sorry, ++shell is not supported on this system"));
#endif
}
! else
! {
! argvar[0].v_type = VAR_STRING;
! argvar[0].vval.v_string = cmd;
! argvar[1].v_type = VAR_UNKNOWN;
! term_start(argvar, NULL, &opt, eap->forceit ? TERM_START_FORCEIT : 0);
! }
!
! vim_free(tofree);
theend:
vim_free(opt.jo_eof_chars);
}
--- 846,876 ----
term_start(NULL, argv, &opt, eap->forceit ? TERM_START_FORCEIT : 0);
vim_free(tofree1);
vim_free(tofree2);
+ goto theend;
#else
+ # ifdef MSWIN
+ long_u cmdlen = STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10;
+ char_u *newcmd;
+
+ newcmd = alloc(cmdlen);
+ if (newcmd == NULL)
+ goto theend;
+ tofree = newcmd;
+ vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd);
+ cmd = newcmd;
+ # else
emsg(_("E279: Sorry, ++shell is not supported on this system"));
+ goto theend;
+ # endif
#endif
}
! argvar[0].v_type = VAR_STRING;
! argvar[0].vval.v_string = cmd;
! argvar[1].v_type = VAR_UNKNOWN;
! term_start(argvar, NULL, &opt, eap->forceit ? TERM_START_FORCEIT : 0);
theend:
+ vim_free(tofree);
vim_free(opt.jo_eof_chars);
}
*** ../vim-8.1.2254/src/testdir/test_terminal.vim 2019-11-03 23:37:08.288934381 +0100
--- src/testdir/test_terminal.vim 2019-11-04 23:04:16.765676853 +0100
***************
*** 2215,2229 ****
endfunc
func Test_terminal_shell_option()
! CheckUnix
! " exec is a shell builtin command, should fail without a shell.
! term exec ls runtest.vim
! call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
! bwipe!
! term ++shell exec ls runtest.vim
! call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
! bwipe!
endfunc
func Test_terminal_setapi_and_call()
--- 2215,2239 ----
endfunc
func Test_terminal_shell_option()
! if has('unix')
! " exec is a shell builtin command, should fail without a shell.
! term exec ls runtest.vim
! call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
! bwipe!
! term ++shell exec ls runtest.vim
! call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
! bwipe!
! elseif has('win32')
! " dir is a shell builtin command, should fail without a shell.
! term dir /b runtest.vim
! call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
! bwipe!
!
! term ++shell dir /b runtest.vim
! call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
! bwipe!
! endif
endfunc
func Test_terminal_setapi_and_call()
*** ../vim-8.1.2254/src/version.c 2019-11-04 22:52:08.366798096 +0100
--- src/version.c 2019-11-04 23:04:36.745623833 +0100
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 2255,
/**/
--
'Well, here's something to occupy you and keep your mind off things.'
'It won't work, I have an exceptionally large mind.'
-- Douglas Adams, "The Hitchhiker's Guide to the Galaxy"
/// Bram Moolenaar -- Br...@Moolenaar.net --
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 ///