Fix non-zero exit code errors in middle of pipeline (#13899)

# Description
Fixes #13868. Should come after #13885.

# User-Facing Changes
Bug fix.

# Tests + Formatting
Added a test.
This commit is contained in:
Ian Manske
2024-10-02 04:04:18 -07:00
committed by GitHub
parent 475aa4f1dd
commit f03ba6793e
7 changed files with 37 additions and 8 deletions

View File

@ -182,6 +182,8 @@ impl Command for Save {
}
(None, None) => {}
};
child.wait()?;
}
}

View File

@ -180,12 +180,19 @@ impl Command for External {
}
// Wrap the output into a `PipelineData::ByteStream`.
let child = ChildProcess::new(
let mut child = ChildProcess::new(
child,
merged_stream,
matches!(stderr, OutDest::Pipe),
call.head,
)?;
if matches!(stdout, OutDest::Pipe | OutDest::PipeSeparate)
|| matches!(stderr, OutDest::Pipe | OutDest::PipeSeparate)
{
child.ignore_error(true);
}
Ok(PipelineData::ByteStream(
ByteStream::child(child, call.head),
None,