fix wrong return value of process::exec() default tip

Fri, 20 Jun 2025 17:15:18 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 20 Jun 2025 17:15:18 +0200
changeset 53
1c80ba4a0d62
parent 52
e9edc3bd0301

fix wrong return value of process::exec()

src/process.cpp file | annotate | diff | comparison | revisions
--- a/src/process.cpp	Mon May 19 16:05:58 2025 +0200
+++ b/src/process.cpp	Fri Jun 20 17:15:18 2025 +0200
@@ -108,8 +108,11 @@
         // wait for the process to completely finish
         int status = -1;
         waitpid(pid, &status, 0);
-
-        return status;
+        if (WIFEXITED(status)) {
+            return WEXITSTATUS(status);
+        } else {
+            return -1;
+        }
     } else {
         perror("fork");
         return -1;

mercurial