mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00: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
1 changed files with 2 additions and 0 deletions
|
@ -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,
|
// This allows reusing the same argv in multiple argparse calls,
|
||||||
// or just ignoring the error (e.g. in completions).
|
// or just ignoring the error (e.g. in completions).
|
||||||
opts.argv.push_back(arg_contents - 1);
|
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;
|
if (retval != STATUS_CMD_OK) return retval;
|
||||||
long_idx = -1;
|
long_idx = -1;
|
||||||
|
|
Loading…
Reference in a new issue