Skip to content

fix(desktop): prevent workspace git console flashes on Windows#2935

Merged
esengine merged 1 commit into
esengine:main-v2from
Nahiyi:fix/windows-terminal-flash
Jun 4, 2026
Merged

fix(desktop): prevent workspace git console flashes on Windows#2935
esengine merged 1 commit into
esengine:main-v2from
Nahiyi:fix/windows-terminal-flash

Conversation

@Nahiyi

@Nahiyi Nahiyi commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Fixes the Windows desktop workspace panel flashing console windows when it runs
git status probes.

This keeps the shared proc.HideWindow helper on CREATE_NO_WINDOW only, so
shell tools such as PowerShell keep stdout/stderr capture working. The detached
process behavior is scoped to the desktop workspace git probes via a Windows-only
proc.HideWindowDetached helper, with a non-Windows no-op stub.

Also adds proc-level regression coverage that HideWindow still captures child
stdout.

Closes #2930

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Jun 3, 2026
@Nahiyi Nahiyi force-pushed the fix/windows-terminal-flash branch from 3d1991a to 4829f23 Compare June 3, 2026 13:08
@esengine

esengine commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Thanks for tackling this — the flashing console windows from git.exe grandchildren on the desktop build are a real annoyance (#2930), and the cross-platform guarding here is done right: hide_windows.go is behind //go:build windows with a !windows no-op stub, so Linux/macOS builds stay clean.

There's one blocker before I can merge, though. Adding DETACHED_PROCESS (0x00000008) alongside CREATE_NO_WINDOW regresses child-process stdout capture. The bash tool routes every command through setKillTreeproc.HideWindow, so the new flag lands on every command the agent runs, and the captured output comes back empty:

--- FAIL: TestBashPowerShellRunsNativeCommand
    bash_powershell_test.go:41: output = "", want it to contain reasonix-ok
--- FAIL: TestBashPowerShellSurfacesNonZeroExit
--- FAIL: TestBashPowerShellAllowsQuotedOperator
--- FAIL: TestBashPowerShellOutputIsUTF8
    bash_powershell_test.go:100: non-ASCII output mojibake — got "" (want it to contain 中文)

Root cause: DETACHED_PROCESS and CREATE_NO_WINDOW are conflicting console-disposition flags. DETACHED_PROCESS fully detaches the child from the console subsystem, which breaks the stdout/stderr pipe the tool relies on. CREATE_NO_WINDOW on its own already runs the child with no visible window — so dropping DETACHED_PROCESS and keeping just CREATE_NO_WINDOW (+ HideWindow) should suppress the flash without severing output.

Could you drop the DETACHED_PROCESS bit and confirm go test ./internal/tool/builtin stays green on Windows? Would also be good to add a proc-level test asserting child stdout is still captured with the flag set, since the internal/proc suite only checks the flag bits and missed this. Happy to merge once output capture is preserved.

Keep proc.HideWindow limited to CREATE_NO_WINDOW so shell tools preserve
stdout/stderr capture, and add a Windows-only HideWindowDetached helper for
desktop workspace git probes that flash console windows from the GUI build.

Add proc-level coverage that HideWindow still captures child stdout.

Closes esengine#2930
@Nahiyi Nahiyi force-pushed the fix/windows-terminal-flash branch from 4829f23 to 6badfb0 Compare June 4, 2026 05:59
@Nahiyi Nahiyi changed the title fix(proc): prevent child processes from flashing console windows on Windows desktop (#2930) fix(desktop): prevent workspace git console flashes on Windows Jun 4, 2026
@Nahiyi

Nahiyi commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Updated.

proc.HideWindow no longer sets DETACHED_PROCESS; it stays on CREATE_NO_WINDOW
so shell tools preserve stdout/stderr capture. I added a proc-level regression
test for child stdout capture and confirmed go test -count=1 ./internal/tool/builtin
passes on Windows.

The detached behavior is now scoped only to the desktop workspace git probes that
reproduce #2930, with a non-Windows no-op stub. I also kept CREATE_NO_WINDOW and
DETACHED_PROCESS out of the same shared helper path, matching the Windows process
creation flag semantics:
https://learn.microsoft.com/en-us/windows/win32/procthread/process-creation-flags

@esengine esengine merged commit 3fecc32 into esengine:main-v2 Jun 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Windows 桌面版操作侧边栏时频繁闪烁 CMD/Git 终端窗口

2 participants