summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-04 23:18:35 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-04 23:18:35 +0100
commit2d6d76f9cd3c5dca0676491d7d60ff7685942487 (patch)
tree5492d11d37d044c65926936cd40005bbfe66c2cc
parent0630bb6580237fe01db22a84885c10f12580f7af (diff)
downloadvim-git-2d6d76f9cd3c5dca0676491d7d60ff7685942487.tar.gz
patch 8.1.2255: ":term ++shell" does not work on MS-Windowsv8.1.2255
Problem: ":term ++shell" does not work on MS-Windows. Solution: Add MS-Windows support.
-rw-r--r--src/terminal.c28
-rw-r--r--src/testdir/test_terminal.vim28
-rw-r--r--src/version.c2
3 files changed, 40 insertions, 18 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 290d7c7ba..a3ca99339 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -846,21 +846,31 @@ ex_terminal(exarg_T *eap)
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
}
- 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);
+ 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);
}
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 1a126b9e1..ba179595a 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -2215,15 +2215,25 @@ func Test_terminal_altscreen()
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!
+ 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()
diff --git a/src/version.c b/src/version.c
index 79f35762f..4315a17e9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2255,
+/**/
2254,
/**/
2253,