summaryrefslogtreecommitdiff
path: root/src/channel.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-21 23:00:27 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-21 23:00:27 +0200
commita69b39511d769bc88f0854bd026556fdb9bd2817 (patch)
treea1ef5f17d72738d542456d44059885905f5ddf26 /src/channel.c
parent2060892028e05b1325dc0759259254180669eb5e (diff)
downloadvim-git-a69b39511d769bc88f0854bd026556fdb9bd2817.tar.gz
patch 8.0.1746: MS-Windows: channel tests failv8.0.1746
Problem: MS-Windows: channel tests fail. Solution: Make a copy of the command before splitting it.
Diffstat (limited to 'src/channel.c')
-rw-r--r--src/channel.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/channel.c b/src/channel.c
index dbc7d92de..fbf1cbeb9 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -5563,6 +5563,8 @@ job_start(typval_T *argvars, char **argv_arg, jobopt_T *opt_arg)
#endif
if (argvars[0].v_type == VAR_STRING)
{
+ char_u *cmd_copy;
+
/* Command is a string. */
cmd = argvars[0].vval.v_string;
if (cmd == NULL || *cmd == NUL)
@@ -5570,12 +5572,18 @@ job_start(typval_T *argvars, char **argv_arg, jobopt_T *opt_arg)
EMSG(_(e_invarg));
goto theend;
}
- /* This will modify "cmd". */
- if (mch_parse_cmd(cmd, FALSE, &argv, &argc) == FAIL)
+ /* Make a copy, parsing will modify "cmd". */
+ cmd_copy = vim_strsave(cmd);
+ if (cmd_copy == NULL
+ || mch_parse_cmd(cmd_copy, FALSE, &argv, &argc) == FAIL)
+ {
+ vim_free(cmd_copy);
goto theend;
+ }
for (i = 0; i < argc; i++)
argv[i] = (char *)vim_strsave((char_u *)argv[i]);
argv[argc] = NULL;
+ vim_free(cmd_copy);
}
else if (argvars[0].v_type != VAR_LIST
|| argvars[0].vval.v_list == NULL