From 57256e53e58146e5984783ea6c29d0af515bebea Mon Sep 17 00:00:00 2001 From: Ashley Wulber Date: Thu, 22 Aug 2024 10:32:07 -0400 Subject: [PATCH] fix(process): wait on child to prevent zombie --- src/process.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/process.rs b/src/process.rs index e6a5c09f..efbfdd10 100644 --- a/src/process.rs +++ b/src/process.rs @@ -37,7 +37,10 @@ pub async fn spawn(mut command: Command) -> Option { 1.. => { // Drop copy of write end, then read PID from pipe drop(write); - read_from_pipe(read).await + let pid = read_from_pipe(read).await; + // wait to prevent zombie + _ = rustix::process::wait(rustix::process::WaitOptions::empty()); + pid } // Child process