summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJan Haller <bromeon@gmail.com>2022-07-02 01:05:20 +0200
committerJan Haller <bromeon@gmail.com>2022-07-02 01:17:35 +0200
commitd38d76d039a20bfcbc0a8612fee1c9a37cc21c78 (patch)
treeb37c34b08060ca85c12720d7587178defd425658 /main
parenta2459c7d35eeaeea8b1d4fa9ce6c9cbe74f11643 (diff)
Fix exit code of --help and --version, and test them in CI
Corrects prior regression which caused ERROR output and exit code of 1.
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 00b7483406..0205b9c157 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -691,12 +691,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
show_help = true;
- exit_code = OK;
+ exit_code = ERR_HELP; // Hack to force an early exit in `main()` with a success code.
goto error;
} else if (I->get() == "--version") {
print_line(get_full_version_string());
- exit_code = OK;
+ exit_code = ERR_HELP; // Hack to force an early exit in `main()` with a success code.
goto error;
} else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output