fix(control): a launched game gets the supervisor's hidden console, not a console window of its own #589
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!589
Loading…
Reference in a new issue
No description provided.
Delete branch "llun/Longshot:fix/ctl-hidden-console"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type: fix · Risk: low · Tested on: Windows 11, RTX 5080 · Needs: none
Why
On Windows, every game that
longshot_ctl.py launchstarts as a console program opens a console window of its own, which flashes on the desktop for about a second. That covers a development build of the game, a--wrapper, and the tests' stand-in game. It came in with #47 (durable command-line sessions), which was tested on Linux only, where the same call opens no windows. The full suite now does it dozens of times:tests/test_longshot_ctl.pyalone opened 28 console windows in 30 seconds here, so anyone runningtests/run_all.pyon Windows sees windows flashing up while it runs. See #47.How to reproduce
Seen on: Windows 11 (build 26300), RTX 5080, driver 621.14; Windows Terminal is the default console
Settings and switches: defaults
Steps: run
python -I -B tests/run_all.py test_longshot_ctlonmain, and watch the desktopExpected: no windows
Actual: a Windows Terminal window opens and closes for each stand-in game the test launches (28 in about 30 s)
What changed
The launcher's supervisor now starts with a console of its own that has no window (
CREATE_NO_WINDOW), in place of no console at all (DETACHED_PROCESS), and the game it starts inherits that console. The supervisor is still independent of the caller's console and keeps its own process group, so the run still outlives the command that started it, as #47 intends.start_sessioninscripts/longshot_ctl.py: the supervisor'screationflagschange fromCREATE_NEW_PROCESS_GROUP | DETACHED_PROCESStoCREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW. Linux keepsstart_new_session.tests/test_longshot_ctl.py's stand-in game records whether it has a console, and whether that console is a window on the desktop. On Windows,Sessions.test_profile_manifest_and_second_clientexpects a console with no window:[True, False](onmainit is[True, True]).A release build is a windowed (GUI) program, and Windows gives a GUI program no console of its own, so a release build's launch is unchanged. That includes the console it opens on purpose while it prepares shaders, so a long wait isn't mistaken for a hang.
Measurements
Verdict: it fixes the windows: 28 console windows during
test_longshot_ctlonmain, none with this PR, and none in the whole suite. Nothing to time: the change is in how the launcher starts a process, not in the game.Hardware: Windows 11 Pro 26300, RTX 5080 16 GB, driver 621.14, Ryzen 9 9900X3D, 64 GB
Scene: none (game-free tests); one headless launch of a release build, to the intro
Method: a small watcher listed every new visible console window (
ConsoleWindowClass, Windows Terminal'sCASCADIA_HOSTING_WINDOW_CLASSandPseudoConsoleWindow) with its owning process and command line, every 10 ms, while the tests ranHow to reproduce:
python -I -B tests/run_all.py test_longshot_ctlon each commit, watching the desktop (or any window-listing tool)5d3ecc78e2dd39cetest_longshot_ctl[has one, shown][True, True][True, False]Flags and settings
None
Testing
Tested:
python -I -B tests/run_all.py: 487 passed, 12 failed, 77 skipped. All 12 also fail onmainon this PC: test_fpx_sticky, test_appimage_player_build, test_bake_portability, test_cpm_discovery, test_lift_cleanup_error, test_make_game_cache, test_linux_preflight, test_lift_cache, test_oot_state_tap, test_spawn_emit, test_tested_configurations, test_walk_key.test_longshot_ctlpasses.main([True, True], "the game opened a console window") and passes here.longshot_ctl.py launch --profile test --headless --ready presenton the RTX 5080. It reached the intro (frame 30, 1920x1080),statusanswered,stopended it (finished, exit 0,quit, process exited). The only console window was the game's own shader-preparation console, as onmain. The options file beside the game was unchanged.Not tested: a development build (a console program) launched through the launcher in the game; the stand-in game covers the same path. Linux and macOS: this changes only the Windows branch.
Must be tested: None
Risks
What could break: a launched game now has a console with no window, where before it had none. A development build's
AllocConsolefor shader-preparation progress now finds that console, so it shows nothing; before, the progress went to the build's own visible console window. Its output was already going to the run'slog.txt. A release build is unchanged. Stopping the game is unchanged (terminate/kill).Turning it off: revert the commit
Compatibility: Nothing changes for players. Only the command-line launcher is affected.
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named).third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.mainand passing here.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
WIP: fix(control): a launched game gets the supervisor's hidden console, not a console window of its ownto fix(control): a launched game gets the supervisor's hidden console, not a console window of its owne2dd39cebe763d8cd4d8