Add pipeline redirection support (#4594)

* redirection

* Remove commented-out

* fix tests

* more fixes
This commit is contained in:
JT
2022-02-21 17:22:21 -05:00
committed by GitHub
parent 739e403cd5
commit 9888f8f298
46 changed files with 463 additions and 288 deletions

View File

@ -95,7 +95,7 @@ pub(crate) fn evaluate(
std::process::exit(1);
}
match eval_block(engine_state, &mut stack, &block, input) {
match eval_block(engine_state, &mut stack, &block, input, false, false) {
Ok(pipeline_data) => {
crate::eval_file::print_table_or_error(engine_state, &mut stack, pipeline_data, &config)
}

View File

@ -251,3 +251,9 @@ fn with_env_shorthand_nested_quotes() -> TestResult {
"-arg \"hello world\"",
)
}
#[test]
fn test_redirection_stderr() -> TestResult {
// try a nonsense binary
run_test(r#"do -i { asdjw4j5cnaabw44rd }; echo done"#, "done")
}

View File

@ -226,7 +226,7 @@ pub(crate) fn eval_source(
report_error(&working_set, &err);
}
match eval_block(engine_state, stack, &block, input) {
match eval_block(engine_state, stack, &block, input, false, false) {
Ok(pipeline_data) => {
if let Err(err) = print_pipeline_data(pipeline_data, engine_state, stack) {
let working_set = StateWorkingSet::new(engine_state);