Repository navigation
fix: parse process substitution targets in combined redirects - #22
Conversation
`cmd &> >(tee log)` currently reports a missing redirect target and treats the process substitution as another argument. The same happens with `&>>` and `<(...)` targets. Use the existing balanced-target handling for these combined redirects. The tests cover both directions, adjacent tokens, incomplete targets, nested diagnostics and printing. Concatenating a process substitution with more text keeps the existing limitation discussed in webpro-nl#19. All 2,074 tests, type checks, build and formatting passed. Lint passed with the same four existing warnings. Bash 5.1 accepted the 19 valid inputs and their printed output, and the runtime smoke passed on Node 14.
webpro
left a comment
There was a problem hiding this comment.
Thanks, Éverton! This fixes a real gap: Bash 5.3 runs cmd &> >(tee log), while main reports a missing redirect target and turns >(tee log) into an argument, and &> >(tee -a log) is a common idiom. On your branch the structured target, positions, lazy errors inside the substitution and printing all check out, &>>>(tee log) and &><(cat input) parse, and &>>(cat) stays an error as in Bash. The branch merges cleanly with main, the full suite passes on the merged tree, and throughput on the README fixtures is unchanged within run-to-run spread, as expected for a branch that only runs on &> tokens.
One change before merging, inline below: the new block is a copy of the process-substitution target handling that the shared redirect tail of tryReadOperator already has, even though the description says the existing balanced-target handling is reused. Once the two share one implementation this is good to go.
commit: |
webpro
left a comment
There was a problem hiding this comment.
Thanks for the quick turnaround. readRedirectTarget is exactly the shape I had in mind, and the move is verbatim: outside the intended inputs, every fixture in the repository parses to an identical AST and prints identically on this branch and on main, and the full suite passes on the branch merged with current main. Since the tail is now a call on every redirect token, I benchmarked the merge against main on the README fixtures in isolated runs: throughput is unchanged within run-to-run spread.
|
🚀 This pull request is included in v6.0.4. See Release 6.0.4 for release notes. |
cmd &> >(tee log)currently reports a missing redirect target and treats the process substitution as another argument. The same happens with&>>and<(...)targets.Use the existing balanced-target handling for these combined redirects. The tests cover both directions, adjacent tokens, incomplete targets, nested diagnostics and printing. Concatenating a process substitution with more text keeps the existing limitation discussed in #19.
All 2,074 tests, type checks, build and formatting passed. Lint passed with the same four existing warnings. Bash 5.1 accepted the 19 valid inputs and their printed output, and the runtime smoke passed on Node 14.