mirror of
https://github.com/neovim/neovim.git
synced 2025-09-15 07:48:18 +00:00
vim-patch:7.4.831
Problem: When expanding `=expr` on the command line and encountering an
error, the command is executed anyway.
Solution: Bail out when an error is detected.
3f188935ec
This commit is contained in:
@@ -1117,6 +1117,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
char_u *p;
|
||||
static bool recursive = false;
|
||||
int add_pat;
|
||||
bool retval = OK;
|
||||
bool did_expand_in_path = false;
|
||||
|
||||
/*
|
||||
@@ -1158,12 +1159,13 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
add_pat = -1;
|
||||
p = pat[i];
|
||||
|
||||
if (vim_backtick(p))
|
||||
if (vim_backtick(p)) {
|
||||
add_pat = expand_backtick(&ga, p, flags);
|
||||
else {
|
||||
/*
|
||||
* First expand environment variables, "~/" and "~user/".
|
||||
*/
|
||||
if (add_pat == -1) {
|
||||
retval = FAIL;
|
||||
}
|
||||
} else {
|
||||
// First expand environment variables, "~/" and "~user/".
|
||||
if (has_env_var(p) || *p == '~') {
|
||||
p = expand_env_save_opt(p, true);
|
||||
if (p == NULL)
|
||||
@@ -1234,7 +1236,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file,
|
||||
|
||||
recursive = false;
|
||||
|
||||
return (ga.ga_data != NULL) ? OK : FAIL;
|
||||
return (ga.ga_data != NULL) ? retval : FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1246,13 +1248,10 @@ static int vim_backtick(char_u *p)
|
||||
return *p == '`' && *(p + 1) != NUL && *(p + STRLEN(p) - 1) == '`';
|
||||
}
|
||||
|
||||
/*
|
||||
* Expand an item in `backticks` by executing it as a command.
|
||||
* Currently only works when pat[] starts and ends with a `.
|
||||
* Returns number of file names found.
|
||||
*/
|
||||
static int
|
||||
expand_backtick (
|
||||
// Expand an item in `backticks` by executing it as a command.
|
||||
// Currently only works when pat[] starts and ends with a `.
|
||||
// Returns number of file names found, -1 if an error is encountered.
|
||||
static int expand_backtick(
|
||||
garray_T *gap,
|
||||
char_u *pat,
|
||||
int flags /* EW_* flags */
|
||||
@@ -1273,8 +1272,9 @@ expand_backtick (
|
||||
buffer = get_cmd_output(cmd, NULL,
|
||||
(flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
|
||||
xfree(cmd);
|
||||
if (buffer == NULL)
|
||||
return 0;
|
||||
if (buffer == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmd = buffer;
|
||||
while (*cmd != NUL) {
|
||||
|
@@ -459,7 +459,7 @@ static int included_patches[] = {
|
||||
834,
|
||||
833,
|
||||
// 832,
|
||||
// 831,
|
||||
831,
|
||||
830,
|
||||
// 829 NA
|
||||
828,
|
||||
|
Reference in New Issue
Block a user