|
|
@@ -57,31 +57,6 @@ def test_bash_command_pexcept(temp_dir, box_class, run_as_openhands):
|
|
|
_close_test_runtime(runtime)
|
|
|
|
|
|
|
|
|
-def test_bash_timeout_and_keyboard_interrupt(temp_dir, box_class, run_as_openhands):
|
|
|
- runtime = _load_runtime(temp_dir, box_class, run_as_openhands)
|
|
|
- try:
|
|
|
- action = CmdRunAction(command='python -c "import time; time.sleep(10)"')
|
|
|
- action.timeout = 1
|
|
|
- obs = runtime.run_action(action)
|
|
|
- logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
|
|
- assert isinstance(obs, CmdOutputObservation)
|
|
|
- assert (
|
|
|
- '[Command timed out after 1 seconds. SIGINT was sent to interrupt it.]'
|
|
|
- in obs.content
|
|
|
- )
|
|
|
- assert 'KeyboardInterrupt' in obs.content
|
|
|
-
|
|
|
- # follow up command should not be affected
|
|
|
- action = CmdRunAction(command='ls')
|
|
|
- action.timeout = 1
|
|
|
- obs = runtime.run_action(action)
|
|
|
- assert isinstance(obs, CmdOutputObservation)
|
|
|
- assert obs.exit_code == 0
|
|
|
- logger.info(obs, extra={'msg_type': 'OBSERVATION'})
|
|
|
- finally:
|
|
|
- _close_test_runtime(runtime)
|
|
|
-
|
|
|
-
|
|
|
def test_multiline_commands(temp_dir, box_class):
|
|
|
runtime = _load_runtime(temp_dir, box_class)
|
|
|
try:
|