test: add TestExecCommandWithOption

This commit is contained in:
dudaodong committed 2023-04-26 17:53:20 +08:00
1 parent 4311b9ac66
commit 424c291813
3 files changed
+17 -8

No files matched your search

+1 -8
View File
@@ -4,18 +4,11 @@ package system
import (
"os/exec"
"syscall"
)
func WithForeground() Option {
return func(c *exec.Cmd) {
if c.SysProcAttr == nil {
c.SysProcAttr = &syscall.SysProcAttr{
Foreground: true,
}
} else {
c.SysProcAttr.Foreground = true
}
}
}