(command: &str)
| 430 | |
| 431 | #[cfg(windows)] |
| 432 | fn contains_shell_control_operators(command: &str) -> bool { |
| 433 | let mut in_single = false; |
| 434 | let mut in_double = false; |
| 435 | let chars: Vec<char> = command.chars().collect(); |
| 436 | let mut i = 0usize; |
| 437 | while i < chars.len() { |
| 438 | let ch = chars[i]; |
| 439 | if ch == '\'' && !in_double { |
| 440 | in_single = !in_single; |
| 441 | } else if ch == '"' && !in_single { |
| 442 | in_double = !in_double; |
| 443 | } else if !in_single && !in_double { |
| 444 | if matches!(ch, '|' | ';' | '>' | '<') { |
| 445 | return true; |
| 446 | } |
| 447 | if ch == '&' && i + 1 < chars.len() && chars[i + 1] == '&' { |
| 448 | return true; |
| 449 | } |
| 450 | } |
| 451 | i += 1; |
| 452 | } |
| 453 | false |
| 454 | } |
| 455 | |
| 456 | #[cfg(windows)] |
| 457 | fn tokenize_windows_command(command: &str) -> Option<Vec<String>> { |
no test coverage detected