diff --git a/src/exec.cpp b/src/exec.cpp index bd24f5281..1557caf0b 100644 --- a/src/exec.cpp +++ b/src/exec.cpp @@ -428,9 +428,16 @@ static bool exec_internal_builtin_proc(parser_t &parser, const std::shared_ptrio_mode == io_mode_t::pipe); + streams.err_is_piped = (err_io != nullptr && err_io->io_mode == io_mode_t::pipe); streams.stdin_is_directly_redirected = stdin_is_directly_redirected; streams.io_chain = &proc_io_chain; diff --git a/src/io.h b/src/io.h index ccaa67eb2..39d286e74 100644 --- a/src/io.h +++ b/src/io.h @@ -451,7 +451,12 @@ struct io_streams_t { // < foo.txt bool stdin_is_directly_redirected{false}; - // Indicates whether stdout and stderr are redirected (e.g. to a file or piped). + // Indicates whether stdout and stderr are specifically piped. + // If this is set, then the is_redirected flags must also be set. + bool out_is_piped{false}; + bool err_is_piped{false}; + + // Indicates whether stdout and stderr are at all redirected (e.g. to a file or piped). bool out_is_redirected{false}; bool err_is_redirected{false};