fix(telemetry): prevent tzutil console flash on Windows#13353
Open
adehad wants to merge 1 commit into
Open
Conversation
|
Thanks for your pull request! While it doesn't meet all of our standard requirements, it appears to be a small, focused contribution and has been routed to the team for review. Note: We still encourage linking to an issue with the |
…on Windows DETACHED_PROCESS leaves the gh send-telemetry child with no console at all. When the transitive dependency thlib/go-timezone-local invokes `tzutil /g` to resolve the local IANA timezone, the console-subsystem tzutil binary allocates a fresh conhost — producing a visible window flash on every gh invocation, which accumulates as orphan terminals under terminal configurations that keep windows open on exit. CREATE_NO_WINDOW gives the child a non-visible console that descendants inherit, suppressing the flash. CREATE_NEW_PROCESS_GROUP is preserved so Ctrl+C still does not propagate to the detached telemetry child. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
c855e88 to
3d9f22c
Compare
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.
Fixes #13354
Summary
On Windows, every
ghinvocation that records telemetry produces a brief console window flash. The flash istzutil.exe /gbeing spawned by thegh send-telemetrysubprocess to resolve the local IANA timezone (via the transitive dependencygithub.com/thlib/go-timezone-local).With Windows Terminal configured to keep windows open after exit (e.g.
closeOnExit: never), these conhost instances accumulate.Root cause
internal/telemetry/detach_windows.gospawns the telemetry subprocess withDETACHED_PROCESS. Per the Win32 process creation flags reference:DETACHED_PROCESS— child has no console at all. Any console-subsystem descendant (tzutil.exe) then allocates a fresh conhost on first stdio access, producing the visible flash.CREATE_NO_WINDOW— child runs as a console application without a visible console window. Descendants inherit the non-visible console and don't allocate a new one.DETACHED_PROCESSandCREATE_NO_WINDOWare mutually exclusive.CREATE_NEW_PROCESS_GROUPremains compatible with the chosen flag.Reproduction
Captured process tree on Windows 11:
gh send-telemetryinvokestzlocal.localTZfromTzutil()fromgithub.com/thlib/go-timezone-local, which performsexec.Command("tzutil", "/g")with no Windows-specific window-suppression flags — so the inherited (absent) console determines visibility.Fix
Replace
DETACHED_PROCESSwithCREATE_NO_WINDOW. Single-line behavioural change plus an explanatory comment.