Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix: _interrupt_bash to send multiple Ctrl+C (#4390)

Kilian Lieret746e6595d5d8
diff --git a/openhands/runtime/client/client.py b/openhands/runtime/client/client.py
index 6966b62eb8..a7565fa381 100644
--- a/openhands/runtime/client/client.py
+++ b/openhands/runtime/client/client.py
@@ -322,12 +322,11 @@ class RuntimeClient:
interrupt_timeout: int | None = None,
max_retries: int = 2,
) -> tuple[str, int]:
- self.shell.sendintr() # send SIGINT to the shell
- logger.debug('Sent SIGINT to bash. Waiting for output...')
-
interrupt_timeout = interrupt_timeout or 1 # default timeout for SIGINT
# try to interrupt the bash shell use SIGINT
while max_retries > 0:
+ self.shell.sendintr() # send SIGINT to the shell
+ logger.debug('Sent SIGINT to bash. Waiting for output...')
try:
self.shell.expect(self.__bash_expect_regex, timeout=interrupt_timeout)
output = self.shell.before