2026-08-11 19:07:05 +08:00
|
|
|
//go:build windows
|
|
|
|
|
|
|
|
|
|
package platform
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os/exec"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestConfigureHidden(t *testing.T) {
|
|
|
|
|
c := exec.Command("cmd.exe", "/c", "exit", "0")
|
|
|
|
|
configureHidden(c)
|
|
|
|
|
if c.SysProcAttr == nil || !c.SysProcAttr.HideWindow || c.SysProcAttr.CreationFlags&0x08000000 == 0 {
|
|
|
|
|
t.Fatalf("hidden process flags missing: %#v", c.SysProcAttr)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-08-19 15:46:03 +08:00
|
|
|
|
|
|
|
|
func TestConfigureUpdaterHelper(t *testing.T) {
|
|
|
|
|
c := exec.Command("cmd.exe", "/c", "exit", "0")
|
|
|
|
|
ConfigureUpdaterHelper(c)
|
|
|
|
|
if c.SysProcAttr == nil || !c.SysProcAttr.HideWindow {
|
|
|
|
|
t.Fatalf("updater helper should hide console: %#v", c.SysProcAttr)
|
|
|
|
|
}
|
|
|
|
|
flags := c.SysProcAttr.CreationFlags
|
|
|
|
|
if flags&0x08000000 == 0 || flags&0x00000200 == 0 || flags&0x01000000 == 0 {
|
|
|
|
|
t.Fatalf("updater helper flags missing: %#v", c.SysProcAttr)
|
|
|
|
|
}
|
|
|
|
|
}
|