Skip to content

fix: suppress browser launch in noui builds#812

Merged
rsdmike merged 3 commits intodevice-management-toolkit:mainfrom
nmgaston:noBrowserPopupOnHeadless
Feb 25, 2026
Merged

fix: suppress browser launch in noui builds#812
rsdmike merged 3 commits intodevice-management-toolkit:mainfrom
nmgaston:noBrowserPopupOnHeadless

Conversation

@nmgaston
Copy link
Contributor

Bug: noui builds launch a browser window on startup

When running the console-noui binary (built with -tags=noui), a browser window was being opened on startup. This is incorrect behavior — the noui build is intended for headless/server environments where there is no display or UI.

Root cause

handleDebugMode in cmd/app/main.go unconditionally called go launchBrowser(cfg) whenever GIN_MODE != "debug", with no awareness of the noui build tag.

Fix

Split the browser-launch code into build-tagged files:

File Build tag Purpose
browser.go !noui Real implementation of launchBrowser, openBrowser, CommandExecutor
browser_noui.go noui No-op launchBrowser that does nothing
browser_test.go !noui Browser tests moved out of main_test.go to exclude from noui test builds
main.go / main_test.go Removed redundant browser code and unused imports

Testing

Both build variants compile and all tests pass:

go test ./cmd/app/...
go test -tags=noui ./cmd/app/...

@nmgaston nmgaston force-pushed the noBrowserPopupOnHeadless branch 2 times, most recently from 7ce4fa1 to d81aa7c Compare February 23, 2026 20:38
@nmgaston nmgaston marked this pull request as ready for review February 23, 2026 20:43
@nmgaston nmgaston requested a review from rsdmike February 23, 2026 20:43
@nmgaston nmgaston linked an issue Feb 23, 2026 that may be closed by this pull request
@rsdmike rsdmike enabled auto-merge (rebase) February 25, 2026 16:33
auto-merge was automatically disabled February 25, 2026 16:36

Rebase failed

@rsdmike rsdmike merged commit 26f5b47 into device-management-toolkit:main Feb 25, 2026
17 checks passed
@nmgaston nmgaston deleted the noBrowserPopupOnHeadless branch February 25, 2026 16:46
rsdmike added a commit that referenced this pull request Feb 25, 2026
rsdmike added a commit that referenced this pull request Feb 25, 2026
@RosieAMT
Copy link

🎉 This PR is included in version 1.21.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Headless run open a browser

4 participants