Skip to content

Commit eb50e07

Browse files
authored
MultiServer: exit console task when console thread dies (ArchipelagoMW#2068)
1 parent 6864f28 commit eb50e07

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

MultiServer.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2118,13 +2118,15 @@ def attrtype(input_text: str):
21182118
async def console(ctx: Context):
21192119
import sys
21202120
queue = asyncio.Queue()
2121-
Utils.stream_input(sys.stdin, queue)
2121+
worker = Utils.stream_input(sys.stdin, queue)
21222122
while not ctx.exit_event.is_set():
21232123
try:
21242124
# I don't get why this while loop is needed. Works fine without it on clients,
21252125
# but the queue.get() for server never fulfills if the queue is empty when entering the await.
21262126
while queue.qsize() == 0:
21272127
await asyncio.sleep(0.05)
2128+
if not worker.is_alive():
2129+
return
21282130
input_text = await queue.get()
21292131
queue.task_done()
21302132
ctx.commandprocessor(input_text)

0 commit comments

Comments
 (0)