diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-05-05 11:16:49 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-05-06 13:09:35 +0200 |
commit | d4994870829cacf1d3f4756a732653d679af1d9b (patch) | |
tree | 1da94c8ef26244617eec21adffeeb12dbfa7df06 /src/buildtool/main/cli.cpp | |
parent | 5f899a316dfed58be9c3fe9e81ba3102cf9e9e9e (diff) | |
download | justbuild-d4994870829cacf1d3f4756a732653d679af1d9b.tar.gz |
Extend just exit codes to distinguish different kinds of failures
Diffstat (limited to 'src/buildtool/main/cli.cpp')
-rw-r--r-- | src/buildtool/main/cli.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/buildtool/main/cli.cpp b/src/buildtool/main/cli.cpp index bfb79858..61ef7a09 100644 --- a/src/buildtool/main/cli.cpp +++ b/src/buildtool/main/cli.cpp @@ -225,10 +225,11 @@ auto ParseCommandLineArguments(int argc, char const* const* argv) try { app.parse(argc, argv); } catch (CLI::Error& e) { - std::exit(app.exit(e)); + auto exit_code = app.exit(e); + std::exit(exit_code == 0 ? kExitSuccess : kExitSyntaxError); } catch (std::exception const& ex) { Logger::Log(LogLevel::Error, "Command line parse error: {}", ex.what()); - std::exit(kExitFailure); + std::exit(kExitSyntaxError); } if (*cmd_version) { |