Loops return external stream when external command failed. (#8646)

This commit is contained in:
WindSoilder
2023-04-06 01:38:04 +08:00
committed by GitHub
parent 1fcb98289a
commit 54a18991ab
7 changed files with 83 additions and 4 deletions

View File

@ -122,7 +122,9 @@ impl Command for For {
Ok(pipeline) => {
let exit_code = pipeline.print(&engine_state, stack, false, false)?;
if exit_code != 0 {
break;
return Ok(PipelineData::new_external_stream_with_only_exit_code(
exit_code,
));
}
}
}
@ -164,7 +166,9 @@ impl Command for For {
Ok(pipeline) => {
let exit_code = pipeline.drain_with_exit_code()?;
if exit_code != 0 {
break;
return Ok(PipelineData::new_external_stream_with_only_exit_code(
exit_code,
));
}
}
}

View File

@ -69,7 +69,9 @@ impl Command for Loop {
Ok(pipeline) => {
let exit_code = pipeline.drain_with_exit_code()?;
if exit_code != 0 {
break;
return Ok(PipelineData::new_external_stream_with_only_exit_code(
exit_code,
));
}
}
}

View File

@ -79,7 +79,11 @@ impl Command for While {
Ok(pipeline) => {
let exit_code = pipeline.drain_with_exit_code()?;
if exit_code != 0 {
break;
return Ok(
PipelineData::new_external_stream_with_only_exit_code(
exit_code,
),
);
}
}
}