Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions jupyter_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ async def _async_execute_interactive(
stdin_socket = None

# wait for output and redisplay it
can_stop = False
while True:
if timeout is not None:
timeout = max(0, deadline - time.monotonic())
Expand All @@ -564,12 +565,14 @@ async def _async_execute_interactive(
continue
output_hook(msg)

# stop on idle
if (
msg["header"]["msg_type"] == "status"
and msg["content"]["execution_state"] == "idle"
):
break
if msg["header"]["msg_type"] == "status":
state = msg["content"]["execution_state"]
# allow to stop
if state == "busy":
can_stop = True
# stop on idle
if state == "idle" and can_stop:
break

# output is done, get the reply
if timeout is not None:
Expand Down