From c25a3c9c9ad34c1f30a5a16b596b6b690cb9a7d2 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sat, 20 Jan 2024 17:38:14 +0100 Subject: [PATCH] Improve error handling when launching test process * Use `EXIT_FAILURE` instead of an arbitrary exit status * Print the error message --- tests/testutils.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/testutils.cpp b/tests/testutils.cpp index c2ac4b6..0eba6a9 100644 --- a/tests/testutils.cpp +++ b/tests/testutils.cpp @@ -561,12 +561,11 @@ static int execAppInternal(const char *appPath, const char *const *args, std::st // -> execute application if (enableSearchPath) { execvp(appPath, const_cast(args)); - } else { execv(appPath, const_cast(args)); } - cerr << Phrases::Error << "Unable to execute \"" << appPath << "\": execv() failed" << Phrases::EndFlush; - exit(-101); + cerr << Phrases::Error << "Unable to execute \"" << appPath << "\": " << std::strerror(errno) << Phrases::EndFlush; + exit(EXIT_FAILURE); } #else