From a70d17707f09d61d491594b12691fae73c85acc8 Mon Sep 17 00:00:00 2001 From: qwint Date: Sun, 24 Nov 2024 11:18:06 -0600 Subject: [PATCH] skips opening a subprocess if kivy (and thus the launcher gui) hasn't been loaded so stdin can function as expected on --nogui and similar --- worlds/LauncherComponents.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/worlds/LauncherComponents.py b/worlds/LauncherComponents.py index 3c4c4477ef09..9e517a5a1e91 100644 --- a/worlds/LauncherComponents.py +++ b/worlds/LauncherComponents.py @@ -62,11 +62,15 @@ def __repr__(self): def launch_subprocess(func: Callable, name: str = None, args: Tuple[str, ...] = ()) -> None: - global processes - import multiprocessing - process = multiprocessing.Process(target=func, name=name, args=args) - process.start() - processes.add(process) + import sys + if "kivy" not in sys.modules: + func(*args) + else: + global processes + import multiprocessing + process = multiprocessing.Process(target=func, name=name, args=args) + process.start() + processes.add(process) class SuffixIdentifier: