From 3df7921fdc2f78a08ddd4000dd65c6c8c0f505bb Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 27 Nov 2021 09:05:43 -0600 Subject: [PATCH] Don't call wait twice when closing or gcing. --- src/core/os.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/os.c b/src/core/os.c index b675c635..bd99bc3a 100644 --- a/src/core/os.c +++ b/src/core/os.c @@ -485,7 +485,9 @@ static int janet_proc_gc(void *p, size_t s) { /* Kill and wait to prevent zombies */ kill(proc->pid, SIGKILL); int status; - waitpid(proc->pid, &status, 0); + if (!(proc->flags & JANET_PROC_WAITING)) { + waitpid(proc->pid, &status, 0); + } } #endif return 0;