mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
fish --version
should write to stdout
When explicitly asking for the fish version string the information should go to stdout rather than stderr. Also, there is no reason to use exit_without_destructors() rather than exit() in that code path. We actually want the side-effects of exit() such as flushing stdout and there aren't any threads or other things that could cause a normal exit to fail when that function is run.
This commit is contained in:
parent
2a4a539d86
commit
de1258e09b
1 changed files with 7 additions and 6 deletions
13
src/fish.cpp
13
src/fish.cpp
|
@ -382,7 +382,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *cmds)
|
|||
case 0:
|
||||
{
|
||||
fwprintf(stderr, _(L"getopt_long() unexpectedly returned zero\n"));
|
||||
exit_without_destructors(127);
|
||||
exit(127);
|
||||
}
|
||||
|
||||
case 'c':
|
||||
|
@ -405,8 +405,9 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *cmds)
|
|||
}
|
||||
else
|
||||
{
|
||||
debug(0, _(L"Invalid value '%s' for debug level switch"), optarg);
|
||||
exit_without_destructors(1);
|
||||
fwprintf(stderr, _(L"Invalid value '%s' for debug level switch"),
|
||||
optarg);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -444,15 +445,15 @@ static int fish_parse_opt(int argc, char **argv, std::vector<std::string> *cmds)
|
|||
|
||||
case 'v':
|
||||
{
|
||||
fwprintf(stderr, _(L"%s, version %s\n"), PACKAGE_NAME,
|
||||
fwprintf(stdout, _(L"%s, version %s\n"), PACKAGE_NAME,
|
||||
get_fish_version());
|
||||
exit_without_destructors(0);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
// We assume getopt_long() has already emitted a diagnostic msg.
|
||||
exit_without_destructors(1);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue