Fix external extra (#4777)

* Fix empty table from externals

* Fix empty table from externals
This commit is contained in:
JT
2022-03-07 20:17:33 -05:00
committed by GitHub
parent 35ff1076f3
commit 299fea8538
18 changed files with 138 additions and 41 deletions

View File

@ -34,21 +34,24 @@ impl Command for Complete {
exit_code,
..
} => {
let mut cols = vec!["stdout".to_string()];
let mut cols = vec![];
let mut vals = vec![];
let stdout = stdout.into_bytes()?;
if let Ok(st) = String::from_utf8(stdout.item.clone()) {
vals.push(Value::String {
val: st,
span: stdout.span,
})
} else {
vals.push(Value::Binary {
val: stdout.item,
span: stdout.span,
})
};
if let Some(stdout) = stdout {
cols.push("stdout".to_string());
let stdout = stdout.into_bytes()?;
if let Ok(st) = String::from_utf8(stdout.item.clone()) {
vals.push(Value::String {
val: st,
span: stdout.span,
})
} else {
vals.push(Value::Binary {
val: stdout.item,
span: stdout.span,
})
}
}
if let Some(stderr) = stderr {
cols.push("stderr".to_string());

View File

@ -307,7 +307,15 @@ impl ExternalCommand {
let exit_code_receiver = ValueReceiver::new(exit_code_rx);
Ok(PipelineData::ExternalStream {
stdout: RawStream::new(Box::new(stdout_receiver), output_ctrlc.clone(), head),
stdout: if redirect_stdout {
Some(RawStream::new(
Box::new(stdout_receiver),
output_ctrlc.clone(),
head,
))
} else {
None
},
stderr: Some(RawStream::new(
Box::new(stderr_receiver),
output_ctrlc.clone(),