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(
540540 stdin_socket = None
541541
542542 # wait for output and redisplay it
543+ can_stop = False
543544 while True :
544545 if timeout is not None :
545546 timeout = max (0 , deadline - time .monotonic ())
@@ -564,12 +565,14 @@ async def _async_execute_interactive(
564565 continue
565566 output_hook (msg )
566567
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
573576
574577 # output is done, get the reply
575578 if timeout is not None :
You can’t perform that action at this time.
0 commit comments