diff options
author | Kurtis Rader <krader@skepticism.us> | 2016-03-23 11:42:17 -0700 |
---|---|---|
committer | Kurtis Rader <krader@skepticism.us> | 2016-03-23 11:42:17 -0700 |
commit | de1258e09b3cd4605995297d400ff134fd68b226 (patch) | |
tree | 36eddeee398cbc4397da21e79a993e03daf8d9dd | |
parent | 2a4a539d8696bcd61bac5d558795c2eaa3f78c70 (diff) |
`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.
-rw-r--r-- | src/fish.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/fish.cpp b/src/fish.cpp index bb898be5..17cd1f16 100644 --- a/src/fish.cpp +++ b/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); } } |