diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-18 01:33:39 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-07-18 02:10:52 +0200 |
commit | 7ddd364a83b7a8f3ab6720f805df6b62aee6ea88 (patch) | |
tree | b8cda93951e7e544b341e9bd96a3426e0ebfc138 /src/process.c | |
parent | json_rpc: removed unused routines (diff) | |
download | cimple-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/process.c')
-rw-r--r-- | src/process.c | 2 |
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; |