feat: support redirects in pipe sequence commands#177
Open
bartlomieju wants to merge 1 commit into
Open
Conversation
The parser previously rejected redirects on any command in a pipe sequence (e.g. `cmd 2>&1 | tee log`), even though the AST already carries a per-command `redirect` and the executor's `execute_command` applies it before dispatching to `execute_simple_command` / `execute_subshell`. Drop the parser bailout so common bash idioms like `cmd 2>&1 | reader` and `cmd > file | reader` parse and execute. Fixes denoland/deno#28808.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The parser previously rejected redirects on any command in a pipe
sequence (e.g.
cmd 2>&1 | tee log), even though the AST'sCommandnode already carries a per-command
redirectand the executor'sexecute_commandapplies it before dispatching toexecute_simple_command/
execute_subshell. Drop the parser bailout inparse_pipeline_innerso common bash idioms like
cmd 2>&1 | readerandcmd > file | readerparse and execute.
The existing negative parser test that asserted the error message is
replaced with two positive parser tests covering
echo 1 1> stdout.txt | catandcmd 2>&1 | tee log. Two integration tests exercise theruntime behavior end-to-end: that the left side's stdout redirect makes
the right side receive an empty pipe, and that
2>&1 |correctlyfunnels both stdout and stderr into the pipe.
Fixes denoland/deno#28808.