diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-18 16:45:18 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-09-09 12:40:53 +0200 |
commit | a2d2cf6b3120205e7916b8fc7370127409d7f306 (patch) | |
tree | a070d98157925b42d15503a0464d98bb78090faf /src | |
parent | d17d0d9649ae47b383325020eb147b80e5ce75b3 (diff) | |
download | justbuild-a2d2cf6b3120205e7916b8fc7370127409d7f306.tar.gz |
just-mr: Fix wrong exit code for --help call
Due to the specifics of how CLI11 library handles the --help
argument and the fact that just-mr uses its own set of exit codes,
we were correctly printing the help text, but falsely returning a
non-zero exit code as result.
This is now fixed.
(cherry-picked form faa8fc156ed8314db23a2d1612975ee745a50ade)
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/just_mr/main.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 31f63d3d..d27cb3a5 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -132,8 +132,11 @@ void SetupSetupCommandArguments( try { app.parse(argc, argv); } catch (CLI::Error& e) { - [[maybe_unused]] auto err = app.exit(e); - std::exit(kExitClargsError); + // CLI11 throws for things like --help calls for them to be handled + // separately by parse callers. In this case it nevertheless sets the + // error code to 0 (success). + auto const err = app.exit(e); + std::exit(err == 0 ? kExitSuccess : kExitClargsError); } catch (std::exception const& ex) { Logger::Log(LogLevel::Error, "Command line parse error: {}", ex.what()); std::exit(kExitClargsError); |