system([...]): Set v:shell_error=-1 if not executable.

Do _not_ set v:shell_error on parameter validation error.

system([...]) does not invoke a shell, so this change is somewhat
questionable. But `:help v:shell_error` is sufficiently vague to allow
-1 in this case.
This commit is contained in:
Rui Abreu Ferreira
2016-09-30 15:29:50 +01:00
committed by Justin M. Keyes
parent 4178e865d5
commit 1e079fa987
2 changed files with 11 additions and 1 deletions

View File

@@ -16994,8 +16994,12 @@ static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv,
}
// get shell command to execute
char **argv = tv_to_argv(&argvars[0], NULL, NULL);
bool executable = true;
char **argv = tv_to_argv(&argvars[0], NULL, &executable);
if (!argv) {
if (!executable) {
set_vim_var_nr(VV_SHELL_ERROR, (long)-1);
}
xfree(input);
return; // Already did emsg.
}