| 1 | //go:build windows |
| 2 | |
| 3 | package proc |
| 4 | |
| 5 | import ( |
| 6 | "os/exec" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func TestLowPrioritySetsBelowNormalClass(t *testing.T) { |
| 11 | cmd := exec.Command("cmd", "/c", "echo", "hi") |
| 12 | HideWindow(cmd) |
| 13 | LowPriority(cmd) |
| 14 | if cmd.SysProcAttr == nil || cmd.SysProcAttr.CreationFlags&belowNormalPriorityClass == 0 { |
| 15 | t.Fatalf("BELOW_NORMAL_PRIORITY_CLASS not set; CreationFlags=%#x", cmd.SysProcAttr.CreationFlags) |
| 16 | } |
| 17 | if cmd.SysProcAttr.CreationFlags&createNoWindow == 0 { |
| 18 | t.Fatal("LowPriority must not clobber HideWindow's flags") |
| 19 | } |
| 20 | } |
| 21 |