Browse Source

Fix: Parse exit code correctly for background commands (#3161)

* Parse exit code correctly for background commands

* Update ssh_box.py
மனோஜ்குமார் பழனிச்சாமி 1 year ago
parent
commit
570fd6e483
2 changed files with 2 additions and 2 deletions
  1. 1 1
      opendevin/runtime/client/client.py
  2. 1 1
      opendevin/runtime/docker/ssh_box.py

+ 1 - 1
opendevin/runtime/client/client.py

@@ -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:

+ 1 - 1
opendevin/runtime/docker/ssh_box.py

@@ -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)