mirror of
https://github.com/nushell/nushell.git
synced 2025-06-30 22:50:14 +02:00
Fix external extra (#4777)
* Fix empty table from externals * Fix empty table from externals
This commit is contained in:
@ -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());
|
||||
|
@ -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(),
|
||||
|
Reference in New Issue
Block a user