Merge pull request #241 from nushell/windows_quotes

Fix quoting on external Windows commands
This commit is contained in:
Jonathan Turner 2019-08-02 19:42:17 +12:00 committed by GitHub
commit 65ae811e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,10 +239,17 @@ impl ExternalCommand {
}
} else {
for arg in &self.args {
let arg_chars: Vec<_> = arg.chars().collect();
if arg_chars.len() > 1 && arg_chars[0] == '"' && arg_chars[arg_chars.len() - 1] == '"' {
// quoted string
let new_arg: String = arg_chars[1..arg_chars.len() - 1].iter().collect();
process = process.arg(new_arg);
} else {
process = process.arg(arg.item.clone());
}
}
}
}
#[cfg(not(windows))]
{
let mut new_arg_string = self.name.to_string();