-
-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix parsing of redirect tokens #5322
Conversation
In the parser, wrap redirect tokens such as ">", "a>", and "2>1" in a tuple (along with the name of the redirect file, if applicable) to differentiate them from regular command line arguments. This ensures that a command like ![echo ">"] is parsed correctly. We now need 2 types of IO-redirect tokens (IOREDIRECT1 and IOREDIRECT2) so that the parser knows whether or not an IO-redirect has a file argument. For example, "a>" has type IOREDIRECT1, whereas "2>1" has type IOREDIRECT2.
9b6364a
to
8d24617
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5322 +/- ##
==========================================
+ Coverage 67.14% 67.37% +0.22%
==========================================
Files 119 119
Lines 23125 23137 +12
Branches 4855 4860 +5
==========================================
+ Hits 15528 15588 +60
+ Misses 6391 6330 -61
- Partials 1206 1219 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
8d24617
to
2c10662
Compare
LGTM, Thanks @yaxollum ! |
Hi @yaxollum , I think the following error happens because of the change . I am posting the full traceback with rich tracebacks
|
Fixes #2335
This fix changes the parser so that a command like
echo test > a.txt < b.txt o>e
is passed like['echo', 'test', ('>', 'a.txt'), ('<', 'b.txt'), ('o>e',)]
tocmds_to_specs
.Currently, the command is passed like
['echo', 'test', '>', 'a.txt', '<', 'b.txt', 'o>e']
, which is what causes the ambiguity between a>
redirect token and a">"
string literal.For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 comment