Skip to content

Commit

Permalink
fix: dont crash on unknown shell syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Sep 9, 2024
1 parent d079af4 commit dd6fff7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gptme/tools/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,13 @@ def split_commands(script: str) -> list[str]:
command_parts.append(script[start:end])
command = " ".join(command_parts)
commands.append(command)
elif part.kind == "function":
commands.append(script[part.pos[0] : part.pos[1]])
elif part.kind == "pipeline":
elif part.kind in ["function", "pipeline", "list"]:
commands.append(script[part.pos[0] : part.pos[1]])
else:
logger.warning(f"Unknown shell script part of kind '{part.kind}', skipping")
logger.warning(
f"Unknown shell script part of kind '{part.kind}', hoping this works"
)
commands.append(script[part.pos[0] : part.pos[1]])
return commands


Expand Down

0 comments on commit dd6fff7

Please sign in to comment.