mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
Fix output strip behavior discrepancy among sandboxes (#1355)
This commit is contained in:
@@ -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 exist
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user