mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-11 22:10:09 +01:00
fix: don't divide commands with single quote
This commit is contained in:
parent
985963c230
commit
22b6ad4694
1 changed files with 3 additions and 1 deletions
|
|
@ -82,7 +82,9 @@ fn eval_shell_command(shell: &str, command: &str) -> Vec<String> {
|
|||
}
|
||||
|
||||
pub fn split_command(command: &str) -> Vec<String> {
|
||||
let regex = r#"([^\s"\\]+|"(?:\\.|[^"\\])*"|\\.)+"#;
|
||||
// this regex splits the command separated by spaces, except when the space
|
||||
// is escaped by a backslash or surrounded by quotes
|
||||
let regex = r#"([^\s"'\\]+|"(?:\\.|[^"\\])*"|\\.+|'(?:\\.|[^'\\])*'|\\.)+"#;
|
||||
let regex = Regex::new(regex).unwrap();
|
||||
let split_command = regex
|
||||
.find_iter(command)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue