mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 22:51:13 +08:00
src/builtin_argparse: Work around wgetopt crash
If on the last argument, and it was an unrecognized option, we can't call `wgetopt_long()` again, or it'll crash.
This commit is contained in:
parent
8c9359fdd4
commit
43929ced90
|
@ -574,6 +574,8 @@ static int argparse_parse_flags(parser_t &parser, argparse_cmd_opts_t &opts,
|
|||
// This allows reusing the same argv in multiple argparse calls,
|
||||
// or just ignoring the error (e.g. in completions).
|
||||
opts.argv.push_back(arg_contents - 1);
|
||||
// Work around weirdness with wgetopt, which crashes if we `continue` here.
|
||||
if (w.woptind == argc) break;
|
||||
}
|
||||
if (retval != STATUS_CMD_OK) return retval;
|
||||
long_idx = -1;
|
||||
|
|
Loading…
Reference in New Issue
Block a user