pub fn kill(pattern: &str) -> Result<String, ProcessError>Expand description
Kill processes matching a pattern.
§Arguments
pattern- The pattern to match against process names
§Returns
Ok(String)- A success message indicating processes were killed or none were foundErr(ProcessError)- An error if the kill operation failed
§Examples
// Kill all processes with "server" in their name
use sal_process::kill;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let result = kill("server")?;
println!("{}", result);
Ok(())
}