(input: &str)
| 164 | /// Split shell words well enough to round-trip values emitted by [`shell_escape`]. |
| 165 | #[cfg(any(target_os = "linux", test))] |
| 166 | fn split_proxy_command_words(input: &str) -> Vec<String> { |
| 167 | let mut words = Vec::new(); |
| 168 | let mut current: Option<String> = None; |
| 169 | let mut chars = input.chars(); |
| 170 | while let Some(c) = chars.next() { |
| 171 | match c { |
| 172 | c if c.is_whitespace() => { |
| 173 | if let Some(word) = current.take() { |
| 174 | words.push(word); |
| 175 | } |
| 176 | } |
| 177 | '\'' => { |
| 178 | let buf = current.get_or_insert_with(String::new); |
| 179 | for q in chars.by_ref() { |
| 180 | if q == '\'' { |
| 181 | break; |
| 182 | } |
| 183 | buf.push(q); |
| 184 | } |
| 185 | } |
| 186 | '"' => { |
| 187 | let buf = current.get_or_insert_with(String::new); |
| 188 | for q in chars.by_ref() { |
| 189 | if q == '"' { |
| 190 | break; |
| 191 | } |
| 192 | buf.push(q); |
| 193 | } |
| 194 | } |
| 195 | other => current.get_or_insert_with(String::new).push(other), |
| 196 | } |
| 197 | } |
| 198 | if let Some(word) = current.take() { |
| 199 | words.push(word); |
| 200 | } |
| 201 | words |
| 202 | } |
| 203 | |
| 204 | #[derive(Debug, Clone, Copy)] |
| 205 | struct ProxyCommandMatch { |
no test coverage detected