Refuse the command line's update while the game runs, as the window's Updates row does.

`launcher.cli update` downloaded the release and switched to it without asking whether the game ran. The new version's continue-update then failed in its rebuild with "the game is running", which left the new launcher with the old build until Rebuild the Game. The window's App.start_update refuses first; the command now does the same before its update check, and ends with exit code 1 and "error: the game is running: close it first, the update rebuilds it".

Not reproduced before the change: found by reading the code. Checks that passed: tests/launcher_test.py (217 tests, a new one in which a running game stops `update` before its check and its download, which fails before the change) and tools/check_content.py --staged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-13 17:19:54 -05:00
parent 814c10b355
commit 73d6c8ffb8
2 changed files with 23 additions and 0 deletions

View File

@@ -101,6 +101,12 @@ def run(a, ctx, held):
return 0
if a.cmd == 'update':
# The new version rebuilds the game (ContinueUpdateJob), which cannot replace a running exe: refused here
# before anything is downloaded, as the window's Updates row refuses (ui/app.py App.start_update)
gd = s.get('game_dir')
if gd and build.game_running(gd):
print('error: the game is running: close it first, the update rebuilds it', file=sys.stderr)
return 1
check = jobs.CheckJob(ctx).run_inline()
if check.result != 'ok' or not jobs.update_available(ctx, check.release):
print(check.error or f'up to date: {ctx.version}')