mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 20:47:44 +02:00
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:
@ -147,6 +147,7 @@ impl Command for Do {
|
||||
None
|
||||
};
|
||||
|
||||
child.ignore_error(false);
|
||||
child.wait()?;
|
||||
|
||||
let mut child = ChildProcess::from_raw(None, None, None, span);
|
||||
@ -172,7 +173,7 @@ impl Command for Do {
|
||||
) =>
|
||||
{
|
||||
if let ByteStreamSource::Child(child) = stream.source_mut() {
|
||||
child.ignore_error();
|
||||
child.ignore_error(true);
|
||||
}
|
||||
Ok(PipelineData::ByteStream(stream, metadata))
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::{engine::StateWorkingSet, OutDest};
|
||||
use nu_protocol::{engine::StateWorkingSet, ByteStreamSource, OutDest};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Ignore;
|
||||
@ -32,8 +32,13 @@ impl Command for Ignore {
|
||||
_engine_state: &EngineState,
|
||||
_stack: &mut Stack,
|
||||
_call: &Call,
|
||||
input: PipelineData,
|
||||
mut input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
if let PipelineData::ByteStream(stream, _) = &mut input {
|
||||
if let ByteStreamSource::Child(child) = stream.source_mut() {
|
||||
child.ignore_error(true);
|
||||
}
|
||||
}
|
||||
input.drain()?;
|
||||
Ok(PipelineData::empty())
|
||||
}
|
||||
|
Reference in New Issue
Block a user