fix(process): wait on child to prevent zombie
This commit is contained in:
parent
1162011ff4
commit
57256e53e5
1 changed files with 4 additions and 1 deletions
|
|
@ -37,7 +37,10 @@ pub async fn spawn(mut command: Command) -> Option<u32> {
|
||||||
1.. => {
|
1.. => {
|
||||||
// Drop copy of write end, then read PID from pipe
|
// Drop copy of write end, then read PID from pipe
|
||||||
drop(write);
|
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
|
// Child process
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue