| 1 | //go:build windows |
| 2 | |
| 3 | package installsource |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | "testing" |
| 8 | ) |
| 9 | |
| 10 | func TestPluginGitCommandHidesConsoleWindow(t *testing.T) { |
| 11 | cmd := pluginGitCommand(context.Background(), "version") |
| 12 | if cmd.SysProcAttr == nil { |
| 13 | t.Fatal("plugin git command must set Windows process attributes") |
| 14 | } |
| 15 | const createNoWindow = 0x08000000 |
| 16 | if cmd.SysProcAttr.CreationFlags&createNoWindow == 0 || !cmd.SysProcAttr.HideWindow { |
| 17 | t.Fatalf("plugin git command can flash a console window: %+v", cmd.SysProcAttr) |
| 18 | } |
| 19 | } |
| 20 |