0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.2255: ":term ++shell" does not work on MS-Windows

Problem:    ":term ++shell" does not work on MS-Windows.
Solution:   Add MS-Windows support.
This commit is contained in:
Bram Moolenaar
2019-11-04 23:18:35 +01:00
parent 0630bb6580
commit 2d6d76f9cd
3 changed files with 39 additions and 17 deletions

View File

@@ -846,21 +846,31 @@ ex_terminal(exarg_T *eap)
term_start(NULL, argv, &opt, eap->forceit ? TERM_START_FORCEIT : 0); term_start(NULL, argv, &opt, eap->forceit ? TERM_START_FORCEIT : 0);
vim_free(tofree1); vim_free(tofree1);
vim_free(tofree2); vim_free(tofree2);
goto theend;
#else #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")); emsg(_("E279: Sorry, ++shell is not supported on this system"));
goto theend;
# endif
#endif #endif
} }
else
{
argvar[0].v_type = VAR_STRING; argvar[0].v_type = VAR_STRING;
argvar[0].vval.v_string = cmd; argvar[0].vval.v_string = cmd;
argvar[1].v_type = VAR_UNKNOWN; argvar[1].v_type = VAR_UNKNOWN;
term_start(argvar, NULL, &opt, eap->forceit ? TERM_START_FORCEIT : 0); term_start(argvar, NULL, &opt, eap->forceit ? TERM_START_FORCEIT : 0);
}
vim_free(tofree);
theend: theend:
vim_free(tofree);
vim_free(opt.jo_eof_chars); vim_free(opt.jo_eof_chars);
} }

View File

@@ -2215,7 +2215,7 @@ func Test_terminal_altscreen()
endfunc endfunc
func Test_terminal_shell_option() func Test_terminal_shell_option()
CheckUnix if has('unix')
" exec is a shell builtin command, should fail without a shell. " exec is a shell builtin command, should fail without a shell.
term exec ls runtest.vim term exec ls runtest.vim
call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))}) call WaitForAssert({-> assert_match('job failed', term_getline(bufnr(), 1))})
@@ -2224,6 +2224,16 @@ func Test_terminal_shell_option()
term ++shell exec ls runtest.vim term ++shell exec ls runtest.vim
call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))}) call WaitForAssert({-> assert_match('runtest.vim', term_getline(bufnr(), 1))})
bwipe! 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 endfunc
func Test_terminal_setapi_and_call() func Test_terminal_setapi_and_call()

View File

@@ -741,6 +741,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 */
/**/
2255,
/**/ /**/
2254, 2254,
/**/ /**/