happy icon indicating copy to clipboard operation
happy copied to clipboard

Windows: cmd window flashes every 20s due to missing windowsHide in detectWindows()

Open waihaiwai opened this issue 7 months ago • 6 comments

Problem

On Windows, the happy daemon causes a cmd.exe window to flash every 20 seconds. This interrupts typing and steals focus.

Root Cause

detectWindows() in types-CeXKAJ1l.cjs:2310 runs powershell Get-Command via execSync without windowsHide: true:

child_process.execSync(
  `powershell -NoProfile -Command "Get-Command ${name} -ErrorAction SilentlyContinue"`,
  { stdio: "ignore" }  // missing windowsHide: true
);

This is called from startKeepAlive() every 20 seconds (2e4 ms interval), checking for claude, codex, gemini, and openclaw — spawning 4 cmd.exe windows each time.

Fix

Add windowsHide: true to the execSync options:

child_process.execSync(
  `powershell -NoProfile -Command "Get-Command ${name} -ErrorAction SilentlyContinue"`,
  { stdio: "ignore", windowsHide: true }
);

Note: the codebase already uses windowsHide: true in other places (e.g., AcpBackend spawn).

Environment

  • Windows 11 Pro
  • Happy CLI v1.1.3
  • Node.js v22.13.0

waihaiwai avatar Apr 04 '26 05:04 waihaiwai

TT

joke-lx avatar Apr 05 '26 13:04 joke-lx

This problem is extremely serious and has not been fixed, resulting in it being completely unusable now

zhaoxiaozhao07 avatar Apr 07 '26 02:04 zhaoxiaozhao07

@Scoteezy can you take a look at this after the background bug?

bra1nDump avatar Apr 07 '26 08:04 bra1nDump

This should be fixed by #950 which added windowsHide: true to all spawn/execSync calls, including detectWindows(). Tested on my end and the flashing is gone. Let me know if it still reproduces for you.

Scoteezy avatar Apr 08 '26 15:04 Scoteezy

This should be fixed by #950 which added windowsHide: true to all spawn/execSync calls, including detectWindows(). Tested on my end and the flashing is gone. Let me know if it still reproduces for you.这应该通过 #950 被修复,它在所有 spawn/execSync 调用中添加了 windowsHide: true,包括 detectWindows(). 我在自己的机器上进行了测试,闪光消失了。如果它仍然可以重现,请告诉我。

The problem still persists. I am using the latest version, which was installed via npm install. Later, I referred to some solutions in the issue and, with the help of AI, fixed the problem locally by adding windowsHide: true to all spawn/execSync calls. Below is the AI's summary of the fix:

To maintain consistency and prevent mismatched entry paths in the future, the corresponding CommonJS bundled files have been updated synchronously:

  • dist/index-CFDuT2lI.cjs
  • dist/config-By3tJsda.cjs
  • dist/runCodex-Hj1gDCqd.cjs
  • dist/runOpenClaw-D7GKr0GN.cjs

The same windowsHide: true configuration has been added to the corresponding execSync, execFileSync, and spawn(...) call locations in the above files.

zhaoxiaozhao07 avatar Apr 08 '26 15:04 zhaoxiaozhao07

fixed — added windowsHide: true to all spawn/exec calls across the codebase (PRs #950, #951, #1022). no more cmd.exe popups. npm i -g happy

bra1nDump avatar Apr 13 '26 13:04 bra1nDump