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
This commit is contained in:
Damien Elmes 2025-07-28 21:43:11 +10:00
parent baeccfa3e4
commit 69d54864a8
2 changed files with 12 additions and 6 deletions

View file

@ -156,12 +156,15 @@ def update_and_restart() -> None:
creationflags = ( creationflags = (
subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS 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( subprocess.Popen(
[launcher], [launcher],
start_new_session=True, start_new_session=True,
stdin=subprocess.DEVNULL, stdin=io,
stdout=subprocess.DEVNULL, stdout=io,
stderr=subprocess.DEVNULL, stderr=io,
env=env, env=env,
creationflags=creationflags, creationflags=creationflags,
) )

View file

@ -95,12 +95,15 @@ def update_and_restart() -> None:
creationflags = ( creationflags = (
subprocess.CREATE_NEW_PROCESS_GROUP | subprocess.DETACHED_PROCESS 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( subprocess.Popen(
[launcher], [launcher],
start_new_session=True, start_new_session=True,
stdin=subprocess.DEVNULL, stdin=io,
stdout=subprocess.DEVNULL, stdout=io,
stderr=subprocess.DEVNULL, stderr=io,
env=env, env=env,
creationflags=creationflags, creationflags=creationflags,
) )