Skip to content

Commit

Permalink
exec: always hide cmd window on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
xypwn committed Apr 28, 2024
1 parent 4a73e30 commit 5d62c24
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (r *Runner) Run(name string, stdout io.Writer, stdin io.Reader, args ...str
} else {
cmd = exec.Command(entry.Path, fullArgs...)
}
applyOSSpecificCmdOpts(cmd)

var stderr bytes.Buffer
if stdin != nil {
Expand Down
7 changes: 7 additions & 0 deletions exec/exec_all.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build !windows

package exec

import "os/exec"

func applyOSSpecificCmdOpts(cmd *exec.Cmd) {}
12 changes: 12 additions & 0 deletions exec/exec_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//go:build windows

package exec

import (
"os/exec"
"syscall"
)

func applyOSSpecificCmdOpts(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
}

0 comments on commit 5d62c24

Please sign in to comment.