mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-04 12:52:28 +08:00
fix: ExecCommand can't compile in macos
This commit is contained in:
26
system/os_darwin.go
Normal file
26
system/os_darwin.go
Normal file
@@ -0,0 +1,26 @@
|
||||
//go:build darwin
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func WithWinHide() Option {
|
||||
return func(c *exec.Cmd) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build linux
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
@@ -16,3 +18,9 @@ func WithForeground() Option {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func WithWinHide() Option {
|
||||
return func(c *exec.Cmd) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build windows
|
||||
|
||||
package system
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user