MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / pid_is_alive

Function pid_is_alive

crates/openshell-core/src/forward.rs:92–102  ·  view source on GitHub ↗

Check whether a process is alive.

(pid: u32)

Source from the content-addressed store, hash-verified

90
91/// Check whether a process is alive.
92pub fn pid_is_alive(pid: u32) -> bool {
93 // `kill -0 <pid>` checks if we can signal the process without actually
94 // sending a signal.
95 Command::new("kill")
96 .arg("-0")
97 .arg(pid.to_string())
98 .stdout(std::process::Stdio::null())
99 .stderr(std::process::Stdio::null())
100 .status()
101 .is_ok_and(|s| s.success())
102}
103
104/// Validate that a PID belongs to the expected `OpenShell` SSH forward.
105pub fn pid_matches_openshell_ssh_forward(pid: u32, port: u16, sandbox_id: Option<&str>) -> bool {

Callers 2

stop_forwardFunction · 0.85
list_forwardsFunction · 0.85

Calls 1

successMethod · 0.45

Tested by

no test coverage detected