diff --git a/CommonClient.py b/CommonClient.py index c42024916628..682f55ba4d3e 100644 --- a/CommonClient.py +++ b/CommonClient.py @@ -595,14 +595,15 @@ def on_package(self, cmd: str, args: dict): async def main(args): ctx = TextContext(args.connect, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="server loop") + input_task = None if gui_enabled: - input_task = None from kvui import TextManager ctx.ui = TextManager(ctx) ui_task = asyncio.create_task(ctx.ui.async_run(), name="UI") else: - input_task = asyncio.create_task(console_loop(ctx), name="Input") ui_task = None + if sys.stdin: + input_task = asyncio.create_task(console_loop(ctx), name="Input") await ctx.exit_event.wait() await ctx.shutdown() @@ -614,7 +615,7 @@ async def main(args): import colorama - parser = get_base_parser(description="Gameless Archipelago Client, for text interfaction.") + parser = get_base_parser(description="Gameless Archipelago Client, for text interfacing.") args, rest = parser.parse_known_args() colorama.init() diff --git a/FactorioClient.py b/FactorioClient.py index 292d926ecc97..5c4d9814ada2 100644 --- a/FactorioClient.py +++ b/FactorioClient.py @@ -5,6 +5,7 @@ import string import copy import subprocess +import sys import time import random @@ -294,14 +295,15 @@ async def factorio_spinup_server(ctx: FactorioContext) -> bool: async def main(args): ctx = FactorioContext(args.connect, args.password) ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop") + input_task = None if gui_enabled: - input_task = None from kvui import FactorioManager ctx.ui = FactorioManager(ctx) ui_task = asyncio.create_task(ctx.ui.async_run(), name="UI") else: - input_task = asyncio.create_task(console_loop(ctx), name="Input") ui_task = None + if sys.stdin: + input_task = asyncio.create_task(console_loop(ctx), name="Input") factorio_server_task = asyncio.create_task(factorio_spinup_server(ctx), name="FactorioSpinupServer") succesful_launch = await factorio_server_task if succesful_launch: diff --git a/SNIClient.py b/SNIClient.py index f5d9fba2a43b..10225f73c1e7 100644 --- a/SNIClient.py +++ b/SNIClient.py @@ -1091,15 +1091,15 @@ async def main(): ctx = Context(args.snes, args.connect, args.password) if ctx.server_task is None: ctx.server_task = asyncio.create_task(server_loop(ctx), name="ServerLoop") - + input_task = None if gui_enabled: - input_task = None from kvui import SNIManager ctx.ui = SNIManager(ctx) ui_task = asyncio.create_task(ctx.ui.async_run(), name="UI") else: - input_task = asyncio.create_task(console_loop(ctx), name="Input") ui_task = None + if sys.stdin: + input_task = asyncio.create_task(console_loop(ctx), name="Input") snes_connect_task = asyncio.create_task(snes_connect(ctx, ctx.snes_address), name="SNES Connect") watcher_task = asyncio.create_task(game_watcher(ctx), name="GameWatcher")