Skip to content

Commit 4a3e117

Browse files
committed
Fix: Catch various bashlex errors
1 parent 28f9661 commit 4a3e117

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/swerex/runtime/local.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ async def _run_normal(self, action: BashAction) -> BashObservation:
295295
# (which is also somewhat brittle, so we don't do this by default).
296296
try:
297297
individual_commands = _split_bash_command(action.command)
298-
except bashlex.errors.ParsingError as e:
298+
except Exception as e:
299+
# Bashlex is very buggy and can throw a variety of errors, including
300+
# ParsingErrors, NotImplementedErrors, TypeErrors, possibly more. So we catch them all
299301
self.logger.error("Bashlex fail: %s", e)
300302
action.command += f"\n TMPEXITCODE=$? ; sleep 0.1; echo '{self._UNIQUE_STRING}' ; (exit $TMPEXITCODE)"
301303
fallback_terminator = True

0 commit comments

Comments
 (0)