π OpenHands: AI-Driven Development
Fix output strip behavior discrepancy among sandboxes (#1355)
Boxuan Lic45e2ae4d9f0
diff --git a/opendevin/sandbox/docker/exec_box.py b/opendevin/sandbox/docker/exec_box.pyindex bb62608889..780e77a381 100644--- a/opendevin/sandbox/docker/exec_box.py+++ b/opendevin/sandbox/docker/exec_box.py@@ -122,7 +122,7 @@ class DockerExecBox(Sandbox):self.container.exec_run(f'kill -9 {pid}', workdir=SANDBOX_WORKSPACE_DIR)return -1, f'Command: "{cmd}" timed out'- return exit_code, logs.decode('utf-8')+ return exit_code, logs.decode('utf-8').strip()def copy_to(self, host_src: str, sandbox_dest: str, recursive: bool = False):# mkdir -p sandbox_dest if it doesn't existdiff --git a/opendevin/sandbox/docker/local_box.py b/opendevin/sandbox/docker/local_box.pyindex 99c814c5a7..9cddb591ff 100644--- a/opendevin/sandbox/docker/local_box.py+++ b/opendevin/sandbox/docker/local_box.py@@ -35,7 +35,7 @@ class LocalBox(Sandbox):cmd, shell=True, text=True, capture_output=True,timeout=self.timeout, cwd=config.get('WORKSPACE_BASE'))- return completed_process.returncode, completed_process.stdout+ return completed_process.returncode, completed_process.stdout.strip()except subprocess.TimeoutExpired:return -1, 'Command timed out'