mirror of
https://github.com/nushell/nushell.git
synced 2025-04-02 20:27:11 +02:00
Only escape backslash on windows (#825)
This commit is contained in:
parent
310ecb79b6
commit
bf9340ec48
@ -277,9 +277,21 @@ impl<'call> ExternalCommand<'call> {
|
|||||||
head
|
head
|
||||||
};
|
};
|
||||||
|
|
||||||
let head = head.replace("\\", "\\\\");
|
//let head = head.replace("\\", "\\\\");
|
||||||
|
|
||||||
let mut process = std::process::Command::new(&head);
|
let new_head;
|
||||||
|
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
new_head = head.replace("\\", "\\\\");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
new_head = head;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut process = std::process::Command::new(&new_head);
|
||||||
|
|
||||||
for arg in &self.args {
|
for arg in &self.args {
|
||||||
let arg = trim_enclosing_quotes(arg);
|
let arg = trim_enclosing_quotes(arg);
|
||||||
@ -291,9 +303,19 @@ impl<'call> ExternalCommand<'call> {
|
|||||||
arg
|
arg
|
||||||
};
|
};
|
||||||
|
|
||||||
let arg = arg.replace("\\", "\\\\");
|
let new_arg;
|
||||||
|
|
||||||
process.arg(&arg);
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
new_arg = arg.replace("\\", "\\\\");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
new_arg = arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
process.arg(&new_arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
process
|
process
|
||||||
|
Loading…
Reference in New Issue
Block a user