Fix pipeline stall in do during capture and remove excessive redirections (#7204)

Currently, if you run `do -i { sudo apt upgrade }`, stdin gets swallowed
and doesn't let you respond yes/no to the upgrade question. This PR
fixes that, but runs into https://github.com/nushell/nushell/issues/7205
so the tests fail.

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
This commit is contained in:
Alex Saveau
2023-01-24 21:24:38 -08:00
committed by GitHub
parent d64e381085
commit 5cbaabeeab
3 changed files with 72 additions and 23 deletions

View File

@ -95,7 +95,8 @@ fn save_stderr_and_stdout_to_same_file() {
r#"
let-env FOO = "bar";
let-env BAZ = "ZZZ";
do -i {nu -c 'nu --testbin echo_env FOO; nu --testbin echo_env_stderr BAZ'} | save -r save_test_5/new-file.txt --stderr save_test_5/new-file.txt"#,
do -c {nu -c 'nu --testbin echo_env FOO; nu --testbin echo_env_stderr BAZ'} | save -r save_test_5/new-file.txt --stderr save_test_5/new-file.txt
"#,
);
let actual = file_contents(expected_file);
@ -118,7 +119,8 @@ fn save_stderr_and_stdout_to_diff_file() {
r#"
let-env FOO = "bar";
let-env BAZ = "ZZZ";
do -i {nu -c 'nu --testbin echo_env FOO; nu --testbin echo_env_stderr BAZ'} | save -r save_test_6/log.txt --stderr save_test_6/err.txt"#,
do -c {nu -c 'nu --testbin echo_env FOO; nu --testbin echo_env_stderr BAZ'} | save -r save_test_6/log.txt --stderr save_test_6/err.txt
"#,
);
let actual = file_contents(expected_file);