Commit 0e18bf5
authored
fix(shell): handle bashlex parsing errors for bash builtins like 'time' (#799)
* fix(shell): handle bashlex parsing errors for bash builtins like 'time'
Adds error handling to split_commands() to gracefully fall back when
bashlex can't parse certain bash reserved words and builtins (e.g., 'time').
When bashlex.parse() fails, the function now:
- Logs a warning about the parsing failure
- Returns the script as a single command
This follows the same fallback pattern used for shlex parsing
elsewhere in the file.
Fixes #798
* test(shell): add test and documentation for bash reserved words fallback
Added comprehensive test for split_commands() handling of bash reserved words
that bashlex cannot parse (like 'time'). Improved documentation to explain
why bashlex fails on reserved words and why fallback behavior is correct.
This addresses feedback on PR #799 showing that bashlex (Python port of GNU
bash parser) cannot handle bash reserved words and the fallback approach is
the correct solution.
Co-authored-by: Bob <bob@superuserlabs.org>1 parent 3c2b3f8 commit 0e18bf5
2 files changed
+45
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
1068 | | - | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1069 | 1087 | | |
1070 | 1088 | | |
1071 | 1089 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
250 | 276 | | |
251 | 277 | | |
252 | 278 | | |
| |||
0 commit comments