From 69d54864a8a9b4c9423e090ed5501fbfd8676d17 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 28 Jul 2025 21:43:11 +1000 Subject: [PATCH] Fix launcher display on Tools>Upgrade/Downgrade on Windows 10 Thanks to abdo: https://forums.ankiweb.net/t/anki-25-08-beta-3/64738/6 --- qt/aqt/package.py | 9 ++++++--- qt/launcher/addon/__init__.py | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/qt/aqt/package.py b/qt/aqt/package.py index c8d481312..a2d8fd4c4 100644 --- a/qt/aqt/package.py +++ b/qt/aqt/package.py @@ -156,12 +156,15 @@ def update_and_restart() -> None: creationflags = ( subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS ) + # On Windows 10, changing the handles breaks ANSI display + io = None if sys.platform == "win32" else subprocess.DEVNULL + subprocess.Popen( [launcher], start_new_session=True, - stdin=subprocess.DEVNULL, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, + stdin=io, + stdout=io, + stderr=io, env=env, creationflags=creationflags, ) diff --git a/qt/launcher/addon/__init__.py b/qt/launcher/addon/__init__.py index 799406e86..5b7ce7fc3 100644 --- a/qt/launcher/addon/__init__.py +++ b/qt/launcher/addon/__init__.py @@ -95,12 +95,15 @@ def update_and_restart() -> None: creationflags = ( subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS ) + # On Windows, changing the handles breaks ANSI display + io = None if sys.platform == "win32" else subprocess.DEVNULL + subprocess.Popen( [launcher], start_new_session=True, - stdin=subprocess.DEVNULL, - stdout=subprocess.DEVNULL, - stderr=subprocess.DEVNULL, + stdin=io, + stdout=io, + stderr=io, env=env, creationflags=creationflags, )