Skip to content

fix: preserve shell redirections like 2>&1 when splitting commands#5

Merged
VincentHardouin merged 1 commit into
mainfrom
fix/issue-3-redirection-ampersand
Mar 21, 2026
Merged

fix: preserve shell redirections like 2>&1 when splitting commands#5
VincentHardouin merged 1 commit into
mainfrom
fix/issue-3-redirection-ampersand

Conversation

@VincentHardouin
Copy link
Copy Markdown
Owner

Summary

  • Fix OPERATOR_RE to only match & as a command separator when surrounded by whitespace, preventing false matches in shell redirections like 2>&1, 1>&2
  • Before: find / -name "*.log" 2>&1snip find / -name "*.log" 2>& snip 1
  • After: find / -name "*.log" 2>&1snip find / -name "*.log" 2>&1
  • Adds 4 new tests covering redirection scenarios

Fixes #3

@VincentHardouin VincentHardouin merged commit c74ca67 into main Mar 21, 2026
2 checks passed
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.

Snip only runs on the first command

1 participant