File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -540,6 +540,7 @@ async def _async_execute_interactive(
540
540
stdin_socket = None
541
541
542
542
# wait for output and redisplay it
543
+ can_stop = False
543
544
while True :
544
545
if timeout is not None :
545
546
timeout = max (0 , deadline - time .monotonic ())
@@ -564,12 +565,14 @@ async def _async_execute_interactive(
564
565
continue
565
566
output_hook (msg )
566
567
567
- # stop on idle
568
- if (
569
- msg ["header" ]["msg_type" ] == "status"
570
- and msg ["content" ]["execution_state" ] == "idle"
571
- ):
572
- break
568
+ state = msg ["content" ]["execution_state" ]
569
+ if msg ["header" ]["msg_type" ] == "status" :
570
+ # allow to stop
571
+ if state == 'busy' :
572
+ can_stop = True
573
+ # stop on idle
574
+ if state == 'idle' and can_stop :
575
+ break
573
576
574
577
# output is done, get the reply
575
578
if timeout is not None :
You can’t perform that action at this time.
0 commit comments