File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -600,3 +600,24 @@ def test_preprocess_command_pipeline(executor):
600
600
"grep" ,
601
601
"pattern" ,
602
602
]
603
+
604
+
605
+ @pytest .mark .asyncio
606
+ async def test_command_cleanup_on_error (executor , temp_test_dir , monkeypatch ):
607
+ """Test cleanup of processes when error occurs"""
608
+ clear_env (monkeypatch )
609
+ monkeypatch .setenv ("ALLOW_COMMANDS" , "sleep" )
610
+
611
+ async def execute_with_keyboard_interrupt ():
612
+ # Simulate keyboard interrupt during execution
613
+ result = await executor .execute (
614
+ ["sleep" , "5" ],
615
+ temp_test_dir ,
616
+ timeout = 1
617
+ )
618
+ return result
619
+
620
+ result = await execute_with_keyboard_interrupt ()
621
+ assert result ["error" ] == "Command timed out after 1 seconds"
622
+ assert result ["status" ] == - 1
623
+ assert "execution_time" in result
You can’t perform that action at this time.
0 commit comments