Only reassign exit_code when it is meant to be EXIT_FAILURE

This commit is contained in:
Username404 2021-11-12 22:29:46 +01:00
parent 51e12be9a7
commit d8314513c3
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 4 additions and 2 deletions

View File

@ -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<pair<string, optional<Yerbacon::Exception>>>& currentFuture) -> bool {
if (any_of(Units.rbegin(), Units.rend(), [&printResult](future<pair<string, optional<Yerbacon::Exception>>>& 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;
}