Skip to content

feat(interpreter): implement stderr and combined redirects (2>, 2>&1, &>)#377

Merged
chaliy merged 2 commits intomainfrom
claude/fix-318-stderr-redirects-Vvs93
Feb 27, 2026
Merged

feat(interpreter): implement stderr and combined redirects (2>, 2>&1, &>)#377
chaliy merged 2 commits intomainfrom
claude/fix-318-stderr-redirects-Vvs93

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Feb 27, 2026

Summary

  • Add comprehensive spec tests verifying stderr redirect operations actually route stderr content (not just testing stdout passthrough)
  • Tests cover: 2>/dev/null, 2>file, 2>&1, &>/dev/null, 2>>file, >&2
  • Uses sleep error messages as a real source of stderr content

The parser, lexer, and interpreter already handle these redirect types:

  • Lexer tokenizes 2>, 2>>, 2>&1, &>, >& correctly
  • Parser creates proper AST nodes with fd tracking
  • Interpreter's apply_redirections handles all redirect kinds

Test plan

  • All 1191 bash spec tests pass (10 new tests added)
  • cargo fmt --check clean
  • cargo clippy -p bashkit --all-features -- -D warnings clean
  • All unit tests pass

Closes #318

@chaliy chaliy force-pushed the claude/fix-318-stderr-redirects-Vvs93 branch from c8a1e7e to 61f0490 Compare February 27, 2026 23:14
… &>)

Add comprehensive spec tests for stderr redirect operations:
- 2>/dev/null: suppress stderr output
- 2>file: redirect stderr content to file
- 2>&1: duplicate stderr to stdout in pipelines
- &>/dev/null: suppress both stdout and stderr
- 2>>file: append stderr from multiple commands
- >&2: redirect stdout to stderr

The parser/lexer/interpreter already handle these redirect types.
Tests verify actual stderr content routing (using sleep error messages)
rather than just testing that redirects don't break stdout flow.

Closes #318
@chaliy chaliy force-pushed the claude/fix-318-stderr-redirects-Vvs93 branch from 61f0490 to c8fa079 Compare February 27, 2026 23:25
@chaliy chaliy merged commit d3d162a into main Feb 27, 2026
16 checks passed
@chaliy chaliy deleted the claude/fix-318-stderr-redirects-Vvs93 branch March 12, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement stderr and combined redirects (2>, 2>&1, &>)

2 participants