From de1258e09b3cd4605995297d400ff134fd68b226 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Wed, 23 Mar 2016 11:42:17 -0700 Subject: [PATCH] `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. --- src/fish.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/fish.cpp b/src/fish.cpp index bb898be5f..17cd1f16a 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -382,7 +382,7 @@ static int fish_parse_opt(int argc, char **argv, std::vector *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 *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 *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); } }