From c261f5a90e6c34bebc7af9d35643d07cd5e7973c Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 24 Mar 2020 06:27:35 +0000 Subject: [PATCH] spawn: on OSX only waitpid can get return code --- lib/misc/spawn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/misc/spawn.c b/lib/misc/spawn.c index e8ce6dffd..f9c4a86f5 100644 --- a/lib/misc/spawn.c +++ b/lib/misc/spawn.c @@ -188,7 +188,11 @@ lws_spawn_reap(struct lws_spawn_piped *lsp) } temp = *lsp; - waitid(P_PID, lsp->child_pid, &temp.si, WEXITED | WNOHANG); + n = waitid(P_PID, lsp->child_pid, &temp.si, WEXITED | WNOHANG); + temp.si.si_status &= 0xff; /* we use b8 + for flags */ + lwsl_notice("%s: waitd says %d, process exit %d\n", + __func__, n, temp.si.si_status); + lsp->child_pid = -1; /* destroy the lsp itself first (it's freed and plsp set NULL */