forked from extern/nushell
Add table streaming (#413)
This commit is contained in:
@ -226,6 +226,7 @@ impl ExternalCommand {
|
||||
let mut process = std::process::Command::new(&self.name.item);
|
||||
|
||||
for arg in &self.args {
|
||||
let arg = trim_enclosing_quotes(arg);
|
||||
process.arg(&arg);
|
||||
}
|
||||
|
||||
@ -275,6 +276,16 @@ fn shell_arg_escape(arg: &str) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
fn trim_enclosing_quotes(input: &str) -> String {
|
||||
let mut chars = input.chars();
|
||||
|
||||
match (chars.next(), chars.next_back()) {
|
||||
(Some('"'), Some('"')) => chars.collect(),
|
||||
(Some('\''), Some('\'')) => chars.collect(),
|
||||
_ => input.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
// The piped data from stdout from the external command can be either String
|
||||
// or binary. We use this enum to pass the data from the spawned process
|
||||
#[derive(Debug)]
|
||||
|
Reference in New Issue
Block a user