MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / kill_process_tree

Function kill_process_tree

crates/opencode-tool/src/bash.rs:15–31  ·  view source on GitHub ↗
(pid: u32)

Source from the content-addressed store, hash-verified

13
14#[cfg(unix)]
15async fn kill_process_tree(pid: u32) {
16 let _ = tokio::process::Command::new("pkill")
17 .arg("-TERM")
18 .arg("-P")
19 .arg(pid.to_string())
20 .status()
21 .await;
22
23 tokio::time::sleep(std::time::Duration::from_millis(100)).await;
24
25 let _ = tokio::process::Command::new("pkill")
26 .arg("-KILL")
27 .arg("-P")
28 .arg(pid.to_string())
29 .status()
30 .await;
31}
32
33pub struct BashTool;
34

Callers 1

executeMethod · 0.85

Calls 3

newFunction · 0.85
sleepFunction · 0.85
statusMethod · 0.45

Tested by

no test coverage detected