fix(windows): prevent console window flash

- Centralize hidden-process setup per OS
- Hide console early to avoid startup flash
- Keep capture window off-screen and hidden
- Enable unified scheduler for watchdog task
- Force GUI subsystem in build script
This commit is contained in:
2026-09-01 23:25:06 +03:00
parent e74f74bc4e
commit cc2b1d049b
12 changed files with 103 additions and 36 deletions
+19
View File
@@ -5,4 +5,23 @@ cd "$(dirname "$0")/.."
out="${1:-win64_mp.exe}"
GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -H windowsgui" -o "$out" .
# Belt-and-suspenders: PE subsystem WINDOWS (2) even if ldflags were dropped.
python3 - "$out" <<'PY'
import struct, sys
path = sys.argv[1]
with open(path, "r+b") as f:
f.seek(0x3C)
pe = struct.unpack("<I", f.read(4))[0]
f.seek(pe)
if f.read(4) != b"PE\x00\x00":
raise SystemExit(f"not a PE file: {path}")
opt = pe + 24
f.seek(opt)
magic, = struct.unpack("<H", f.read(2))
if magic not in (0x10B, 0x20B):
raise SystemExit(f"unknown PE magic {magic:#x}")
f.seek(opt + 68)
f.write(struct.pack("<H", 2))
print(f"pe subsystem=gui {path}")
PY
echo "built $out"