mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
wait for child to stop after sending signal
This commit is contained in:
parent
abfd000367
commit
38b15c9736
1 changed files with 8 additions and 1 deletions
|
@ -343,8 +343,15 @@ fn timeout(
|
|||
send_signal(process, signal, foreground);
|
||||
match kill_after {
|
||||
None => {
|
||||
let status = process.wait()?;
|
||||
if preserve_status {
|
||||
Err(ExitStatus::SignalSent(signal).into())
|
||||
if let Some(ec) = status.code() {
|
||||
Err(ec.into())
|
||||
} else if let Some(sc) = status.signal() {
|
||||
Err(ExitStatus::SignalSent(sc.try_into().unwrap()).into())
|
||||
} else {
|
||||
Err(ExitStatus::CommandTimedOut.into())
|
||||
}
|
||||
} else {
|
||||
Err(ExitStatus::CommandTimedOut.into())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue