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

Function process_forward_match_tokens

crates/openshell-core/src/forward.rs:118–129  ·  view source on GitHub ↗
(pid: u32)

Source from the content-addressed store, hash-verified

116/// `ProxyCommand=` values are split so the matcher sees a flat token sequence.
117#[cfg(target_os = "linux")]
118fn process_forward_match_tokens(pid: u32) -> Option<Vec<String>> {
119 let raw = std::fs::read(format!("/proc/{pid}/cmdline")).ok()?;
120 if raw.is_empty() {
121 return None;
122 }
123 let argv: Vec<String> = raw
124 .split(|byte| *byte == 0)
125 .filter(|segment| !segment.is_empty())
126 .flat_map(|segment| expand_proxy_command_arg(&String::from_utf8_lossy(segment)))
127 .collect();
128 (!argv.is_empty()).then_some(argv)
129}
130
131/// Non-Linux fallback. `ps` flattens argv, so paths with spaces fail closed.
132#[cfg(not(target_os = "linux"))]

Callers 1

Calls 3

expand_proxy_command_argFunction · 0.85
is_emptyMethod · 0.45
successMethod · 0.45

Tested by

no test coverage detected