aboutsummaryrefslogtreecommitdiff
path: root/jim-exec.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2022-05-08 15:18:17 +1000
committerSteve Bennett <steveb@workware.net.au>2022-05-08 15:45:27 +1000
commit7f75234e8e68394271ecb8b56a0a117a1d6066a7 (patch)
treec8df7ddccb3fb78b67c19c40e349173e571ba72e /jim-exec.c
parent8bcdb359a0c7217dfebc73c61037a005bb65717d (diff)
downloadjimtcl-7f75234e8e68394271ecb8b56a0a117a1d6066a7.zip
jimtcl-7f75234e8e68394271ecb8b56a0a117a1d6066a7.tar.gz
jimtcl-7f75234e8e68394271ecb8b56a0a117a1d6066a7.tar.bz2
wait: fix support for wait -1
Only on unix systems. Does waitpid(-1, ...) to wait for any child process to exit. Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'jim-exec.c')
-rw-r--r--jim-exec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/jim-exec.c b/jim-exec.c
index 74a4d18..be18fbb 100644
--- a/jim-exec.c
+++ b/jim-exec.c
@@ -614,6 +614,12 @@ static int Jim_WaitCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
if (phandle == JIM_BAD_PHANDLE) {
pid = -1;
}
+ else if (pid < 0) {
+ /* This catches the case where pid=-1. It is only supported on unix where
+ * the returned phandle is a pid, so can simply assign here
+ */
+ pid = phandle;
+ }
errCodeObj = JimMakeErrorCode(interp, pid, status, NULL);