diff --git a/system/os_darwin.go b/system/os_darwin.go index 77fc6c4..617fa47 100644 --- a/system/os_darwin.go +++ b/system/os_darwin.go @@ -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 - } + } } diff --git a/system/os_test.go b/system/os_test.go index c8b6568..2fdad75 100644 --- a/system/os_test.go +++ b/system/os_test.go @@ -68,6 +68,16 @@ func TestExecCommand(t *testing.T) { assert.IsNotNil(err) } +func TestExecCommandWithOption(t *testing.T) { + assert := internal.NewAssert(t, "TestExecCommand") + + stdout, stderr, err := ExecCommand("ls", WithForeground()) + t.Log("std out: ", stdout) + t.Log("std err: ", stderr) + assert.Equal("", stderr) + assert.IsNil(err) +} + func TestGetOsBits(t *testing.T) { osBits := GetOsBits() switch osBits { diff --git a/system/os_windows.go b/system/os_windows.go index 6cd3698..4286fdd 100644 --- a/system/os_windows.go +++ b/system/os_windows.go @@ -18,3 +18,9 @@ func WithWinHide() Option { } } } + +func WithForeground() Option { + return func(c *exec.Cmd) { + + } +}