mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Fix: Parse exit code correctly for background commands (#3161)
* Parse exit code correctly for background commands * Update ssh_box.py
This commit is contained in:
parent
a52df6a272
commit
570fd6e483
@ -128,7 +128,7 @@ class RuntimeClient:
|
||||
self.shell.expect(self.__bash_expect_regex)
|
||||
_exit_code_output = self.shell.before
|
||||
logger.debug(f'Exit code Output: {_exit_code_output}')
|
||||
exit_code = int(_exit_code_output.strip())
|
||||
exit_code = int(_exit_code_output.strip().split()[0])
|
||||
return output, exit_code
|
||||
|
||||
async def run_action(self, action) -> Observation:
|
||||
|
||||
@ -444,7 +444,7 @@ class DockerSSHBox(Sandbox):
|
||||
return self._send_interrupt(
|
||||
cmd, command_output, ignore_last_output=True
|
||||
)
|
||||
cleaned_exit_code_str = exit_code_str.replace('echo $?', '').strip()
|
||||
cleaned_exit_code_str = exit_code_str.replace('echo $?', '').strip().split()[0]
|
||||
|
||||
try:
|
||||
exit_code = int(cleaned_exit_code_str)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user