diff --git a/parse_execution.cpp b/parse_execution.cpp index 70454d15e..cc0a4ddd2 100644 --- a/parse_execution.cpp +++ b/parse_execution.cpp @@ -1011,7 +1011,7 @@ bool parse_execution_context_t::determine_io_chain(const parse_node_t &statement if (old_fd < 0 || errno || *end) { errored = report_error(redirect_node, - _(L"Requested redirection to something that is not a file descriptor %ls"), + _(L"Requested redirection to '%ls', which is not a valid file descriptor"), target.c_str()); } else @@ -1186,7 +1186,7 @@ parse_execution_result_t parse_execution_context_t::populate_job_from_job_node(j { assert(job_cont->type == symbol_job_continuation); - /* Handle the pipe, whose fd may not be the obvious stdoud */ + /* Handle the pipe, whose fd may not be the obvious stdout */ const parse_node_t &pipe_node = *get_child(*job_cont, 0, parse_token_type_pipe); processes.back()->pipe_write_fd = fd_redirected_by_pipe(get_source(pipe_node)); diff --git a/tests/test1.in b/tests/test1.in index c180159c8..7f60a4dad 100644 --- a/tests/test1.in +++ b/tests/test1.in @@ -15,7 +15,7 @@ echo x-{1} echo x-{1,2} echo foo-{1,2{3,4}} -# Escpaed newlines +# Escaped newlines echo foo\ bar echo foo\ bar @@ -99,6 +99,12 @@ echo Test 5 $sta echo Test redirections begin ; echo output ; echo errput 1>&2 ; end 2>&1 | tee /tmp/tee_test.txt ; cat /tmp/tee_test.txt +# Verify that we can pipe something other than stdout +# The first line should be printed, since we output to stdout but pipe stderr to /dev/null +# The second line should not be printed, since we output to stderr and pipe it to /dev/null +begin ; echo is_stdout ; end 2>| cat > /dev/null +begin ; echo is_stderr 1>&2 ; end 2>| cat > /dev/null + # echo tests echo 'abc\ndef' diff --git a/tests/test1.out b/tests/test1.out index c6ecbb308..b3460cdde 100644 --- a/tests/test1.out +++ b/tests/test1.out @@ -23,6 +23,7 @@ errput output errput output +is_stdout abc\ndef abc def