diff options
Diffstat (limited to 'xtask/src/not_bash.rs')
-rw-r--r-- | xtask/src/not_bash.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/xtask/src/not_bash.rs b/xtask/src/not_bash.rs index a6431e586..8844fa216 100644 --- a/xtask/src/not_bash.rs +++ b/xtask/src/not_bash.rs | |||
@@ -153,7 +153,17 @@ fn run_process_inner(cmd: &str, echo: bool, stdin: Option<&[u8]>) -> Result<Stri | |||
153 | 153 | ||
154 | // FIXME: some real shell lexing here | 154 | // FIXME: some real shell lexing here |
155 | fn shelx(cmd: &str) -> Vec<String> { | 155 | fn shelx(cmd: &str) -> Vec<String> { |
156 | cmd.split_whitespace().map(|it| it.to_string()).collect() | 156 | let mut res = Vec::new(); |
157 | for (string_piece, in_quotes) in cmd.split('\'').zip([false, true].iter().copied().cycle()) { | ||
158 | if in_quotes { | ||
159 | res.push(string_piece.to_string()) | ||
160 | } else { | ||
161 | if !string_piece.is_empty() { | ||
162 | res.extend(string_piece.split_ascii_whitespace().map(|it| it.to_string())) | ||
163 | } | ||
164 | } | ||
165 | } | ||
166 | res | ||
157 | } | 167 | } |
158 | 168 | ||
159 | struct Env { | 169 | struct Env { |