pub fn process_get(pattern: &str) -> Result<ProcessInfo, ProcessError>Expand description
Get a single process matching the pattern (error if 0 or more than 1 match).
§Arguments
pattern- The pattern to match against process names
§Returns
Ok(ProcessInfo)- Information about the matching processErr(ProcessError)- An error if no process or multiple processes match
§Examples
use sal_process::process_get;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let process = process_get("unique-server-name")?;
println!("Found process: {} (PID: {})", process.name, process.pid);
Ok(())
}