fix the problem when subprcess clone again
This commit is contained in:
parent
56dd40cd1c
commit
e1ba2f7141
@ -74,7 +74,9 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
loop {
|
||||
log::debug!("parent: waitpid...");
|
||||
match waitpid(child, None)? {
|
||||
let waitstatus = waitpid(child, None)?;
|
||||
|
||||
match waitstatus {
|
||||
WaitStatus::Exited(pid, ret) => {
|
||||
log::info!("child {pid} exited with return code {ret}");
|
||||
break;
|
||||
@ -96,7 +98,9 @@ fn main() -> anyhow::Result<()> {
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
nix::sys::ptrace::cont(child, None)?;
|
||||
if let Some(pid) = waitstatus.pid() {
|
||||
nix::sys::ptrace::cont(pid, None)?;
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
@ -171,4 +175,3 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
panic!("unreachable");
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user