Skip to content

Commit

Permalink
Fix: Add error handling for command execution in SandboxDockerSession
Browse files Browse the repository at this point in the history
  • Loading branch information
vndee committed Feb 22, 2025
1 parent 0636997 commit df887cf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llm_sandbox/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def run(self, code: str, libraries: Optional[List] = None) -> ConsoleOutput:

with open(code_file, "w") as f:
f.write(code)

self.copy_to_runtime(code_file, code_dest_file)

output = ConsoleOutput(text="", exit_code=0)
Expand All @@ -208,6 +208,9 @@ def run(self, code: str, libraries: Optional[List] = None) -> ConsoleOutput:
output = self.execute_command(command, workdir="/example")
else:
output = self.execute_command(command)

if output.exit_code != 0:
return output

return output

Expand Down

0 comments on commit df887cf

Please sign in to comment.