From d8314513c3f1008bceab4a113e60729ae177097e Mon Sep 17 00:00:00 2001 From: Username404 Date: Fri, 12 Nov 2021 22:29:46 +0100 Subject: [PATCH] Only reassign exit_code when it is meant to be EXIT_FAILURE --- src/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ed11743..799707d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -80,7 +80,7 @@ int main(int argc, char* argv[]) { }); }); if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n"; - exit_code = none_of(Units.rbegin(), Units.rend(), [&printResult](future>>& currentFuture) -> bool { + if (any_of(Units.rbegin(), Units.rend(), [&printResult](future>>& currentFuture) -> bool { const auto&& result = currentFuture.get(); const bool is_exception = result.second.has_value(); if (not is_exception) { @@ -93,7 +93,9 @@ int main(int argc, char* argv[]) { cout << "Compilation of " << result.first << " has failed with the following error:\n" << result.second.value().what() << '\n'; } return is_exception; - }) ? EXIT_SUCCESS : EXIT_FAILURE; + })) { + exit_code = EXIT_FAILURE; + } } else cout << "No valid file provided.\n"; return exit_code; } \ No newline at end of file