summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-28 15:51:37 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-28 15:51:37 +0200
commit1a613398068580ca1286ac2ed920f20c978aa662 (patch)
tree05b183b30f8ee99eea6288e9657f6213e7eacdb7 /src/misc2.c
parent0f1c6708fdf17bb9c7305b8af5d12189956195b6 (diff)
downloadvim-git-1a613398068580ca1286ac2ed920f20c978aa662.tar.gz
patch 8.1.2092: MS-Windows: redirect in system() does not workv8.1.2092
Problem: MS-Windows: redirect in system() does not work. Solution: Handle 'shellxescape' and 'shellxquote' better. (Yasuhiro Matsumoto, closes #2054)
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/misc2.c b/src/misc2.c
index f4da4c2d5..da274e603 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -3157,7 +3157,7 @@ call_shell(char_u *cmd, int opt)
{
char_u *ecmd = cmd;
- if (*p_sxe != NUL && STRCMP(p_sxq, "(") == 0)
+ if (*p_sxe != NUL && *p_sxq == '(')
{
ecmd = vim_strsave_escaped_ext(cmd, p_sxe, '^', FALSE);
if (ecmd == NULL)
@@ -3168,11 +3168,11 @@ call_shell(char_u *cmd, int opt)
{
STRCPY(ncmd, p_sxq);
STRCAT(ncmd, ecmd);
- /* When 'shellxquote' is ( append ).
- * When 'shellxquote' is "( append )". */
- STRCAT(ncmd, STRCMP(p_sxq, "(") == 0 ? (char_u *)")"
- : STRCMP(p_sxq, "\"(") == 0 ? (char_u *)")\""
- : p_sxq);
+ // When 'shellxquote' is ( append ).
+ // When 'shellxquote' is "( append )".
+ STRCAT(ncmd, *p_sxq == '(' ? (char_u *)")"
+ : *p_sxq == '"' && *(p_sxq+1) == '(' ? (char_u *)")\""
+ : p_sxq);
retval = mch_call_shell(ncmd, opt);
vim_free(ncmd);
}