Mercurial > vim
diff src/misc2.c @ 18195:a81f0c936112 v8.1.2092
patch 8.1.2092: MS-Windows: redirect in system() does not work
Commit: https://github.com/vim/vim/commit/1a613398068580ca1286ac2ed920f20c978aa662
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 28 15:51:37 2019 +0200
patch 8.1.2092: MS-Windows: redirect in system() does not work
Problem: MS-Windows: redirect in system() does not work.
Solution: Handle 'shellxescape' and 'shellxquote' better. (Yasuhiro
Matsumoto, closes #2054)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Sep 2019 16:00:03 +0200 |
parents | 1868ec23360e |
children | 11f68eb58fda |
line wrap: on
line diff
--- 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); }