| 261 | |
| 262 | #[cfg(windows)] |
| 263 | fn kill_child_process_tree(child: &mut Child) { |
| 264 | // `cmd /C` shims wait for their grandchildren, so a child that already |
| 265 | // exited has no live process tree left; skip the taskkill spawn that |
| 266 | // would fail anyway. |
| 267 | if matches!(child.try_wait(), Ok(Some(_))) { |
| 268 | return; |
| 269 | } |
| 270 | let _ = Command::new("taskkill") |
| 271 | .arg("/PID") |
| 272 | .arg(child.id().to_string()) |
| 273 | .arg("/T") |
| 274 | .arg("/F") |
| 275 | .stdout(Stdio::null()) |
| 276 | .stderr(Stdio::null()) |
| 277 | .status(); |
| 278 | } |
| 279 | |
| 280 | #[cfg(not(windows))] |
| 281 | fn kill_child_process_tree(_child: &mut Child) {} |