[FEATURE] system add option (#87)

This commit is contained in:
Nothin authored and GitHub committed 2023-04-17 14:06:49 +08:00
1 parent d7976e31a4
commit 247cf89947
3 files changed
+47 -1

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
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
}
}
}