(pid: u32)
| 116 | /// `ProxyCommand=` values are split so the matcher sees a flat token sequence. |
| 117 | #[cfg(target_os = "linux")] |
| 118 | fn 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"))] |
no test coverage detected