aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-07-18 01:33:39 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-07-18 02:10:52 +0200
commit7ddd364a83b7a8f3ab6720f805df6b62aee6ea88 (patch)
treeb8cda93951e7e544b341e9bd96a3426e0ebfc138 /src
parentjson_rpc: removed unused routines (diff)
downloadcimple-7ddd364a83b7a8f3ab6720f805df6b62aee6ea88.tar.gz
cimple-7ddd364a83b7a8f3ab6720f805df6b62aee6ea88.zip
process: preserve the exit code more
If the process is killed by a signal, preserve the exit code as it would be reported by $?.
Diffstat (limited to 'src')
-rw-r--r--src/process.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c
index ee387bb..3fc866f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -42,6 +42,8 @@ static int wait_for_child(pid_t pid, int *ec)
if (WIFEXITED(status))
*ec = WEXITSTATUS(status);
+ else if (WIFSIGNALED(status))
+ *ec = status; /* Same as $?. */
else
*ec = -1;