fix: use GUI subsystem for all Windows builds (no console on startup)#3
Merged
Conversation
Debug builds defaulted to the console subsystem, so launching the exe (autostart, shortcut, Explorer) opened a terminal that owned the process - closing it killed the app. Apply windows_subsystem = windows unconditionally on Windows, and re-attach to the parent console in debug so `cargo run` from a terminal still shows logs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On Windows the app boots on startup but opens a terminal window; closing that terminal quits the app.
Cause
src/main.rsonly applied the GUI subsystem in release builds:#![cfg_attr(all(target_os = windows, not(debug_assertions)), windows_subsystem = windows)]Debug builds therefore default to the console subsystem. When Windows launches a console exe (autostart
HKCU\...\Run, a shortcut, or Explorer), it creates a terminal that owns the process, so closing the terminal kills the app.Fix
windows_subsystem = windowsunconditionally on Windows, so no build ever spawns a console window.AttachConsole(ATTACH_PARENT_PROCESS)socargo runfrom a terminal still shows logs (no-op when launched from Explorer/autostart).Win32_System_Consolefeature forAttachConsole.Follow-up for users
After rebuilding, toggle autostart off→on (or re-run the installer) so the
Runkey re-registers the rebuilt GUI binary; a stale entry pointing at an old console exe will keep opening a terminal.🤖 Generated with Claude Code