Skip to main content

detect_from_process_names

Function detect_from_process_names 

Source
pub fn detect_from_process_names(
    process_name: &str,
    exe_name: Option<&str>,
) -> Option<StackLabel>
Expand description

Detect a stack label from a process name, falling back to an executable name.

The process-table name is tried first. When it is unknown (for example because the operating system truncated it), exe_name is tried with the same rules as detect_from_process.

ยงExamples

use what_stack::detect_from_process_names;

assert_eq!(
    detect_from_process_names("redis-serv", Some("redis-server")).expect("known"),
    "Redis",
);
assert_eq!(detect_from_process_names("node", None).expect("known"), "Node.js");
assert_eq!(detect_from_process_names("helper", Some("helper.exe")), None);