mirror of
https://github.com/nushell/nushell.git
synced 2024-12-22 07:02:19 +01:00
Fix linux shell support
This commit is contained in:
parent
6fe9dc0bbf
commit
2045e01945
@ -133,7 +133,11 @@ impl ExternalCommand {
|
|||||||
arg_string.push_str(" ");
|
arg_string.push_str(" ");
|
||||||
arg_string.push_str(&arg);
|
arg_string.push_str(&arg);
|
||||||
}
|
}
|
||||||
let mut process = Exec::shell(&self.name);
|
|
||||||
|
let mut process;
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
process = Exec::shell(&self.name);
|
||||||
|
|
||||||
if arg_string.contains("$it") {
|
if arg_string.contains("$it") {
|
||||||
let mut first = true;
|
let mut first = true;
|
||||||
@ -154,7 +158,34 @@ impl ExternalCommand {
|
|||||||
process = process.arg(arg);
|
process = process.arg(arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
let mut new_arg_string = self.name.to_string();
|
||||||
|
|
||||||
|
if arg_string.contains("$it") {
|
||||||
|
let mut first = true;
|
||||||
|
for i in &inputs {
|
||||||
|
if !first {
|
||||||
|
new_arg_string.push_str(" && ");
|
||||||
|
new_arg_string.push_str(&self.name);
|
||||||
|
} else {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for arg in &self.args {
|
||||||
|
new_arg_string.push_str(" ");
|
||||||
|
new_arg_string.push_str(&arg.replace("$it", &i.as_string().unwrap()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for arg in &self.args {
|
||||||
|
new_arg_string.push_str(" ");
|
||||||
|
new_arg_string.push_str(&arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
process = Exec::shell(new_arg_string);
|
||||||
|
}
|
||||||
process = process.cwd(context.env.lock().unwrap().cwd());
|
process = process.cwd(context.env.lock().unwrap().cwd());
|
||||||
|
|
||||||
let mut process = match stream_next {
|
let mut process = match stream_next {
|
||||||
|
Loading…
Reference in New Issue
Block a user