feat: coredump (#6791)

fix issue in https://github.com/nushell/nushell/issues/5903
return Error to pipeline_data, if match error, then return error
directly
This commit is contained in:
Access
2022-10-23 02:24:58 +08:00
committed by GitHub
parent 8224ec49bc
commit c9fb381d69
2 changed files with 30 additions and 3 deletions

View File

@ -445,9 +445,12 @@ impl PipelineData {
// Make sure everything has finished
if let Some(exit_code) = exit_code {
let mut exit_codes: Vec<_> = exit_code.into_iter().collect();
if let Some(Value::Int { val, .. }) = exit_codes.pop() {
return Ok(val);
}
return match exit_codes.pop() {
#[cfg(unix)]
Some(Value::Error { error }) => Err(error),
Some(Value::Int { val, .. }) => Ok(val),
_ => Ok(0),
};
}
return Ok(0);