diff --git a/pkg/exec/exec.go b/pkg/exec/exec.go index df46f6547..3e85ceb4c 100644 --- a/pkg/exec/exec.go +++ b/pkg/exec/exec.go @@ -5,10 +5,8 @@ import ( "io" "os" "os/exec" - "path/filepath" "github.com/suzuki-shunsuke/go-timeout/timeout" - "golang.org/x/sys/unix" ) type executor struct { @@ -32,10 +30,6 @@ func New() Executor { } } -func (exe *executor) ExecXSys(exePath string, args []string) error { - return unix.Exec(exePath, append([]string{filepath.Base(exePath)}, args...), os.Environ()) //nolint:wrapcheck -} - func (exe *executor) command(cmd *exec.Cmd) *exec.Cmd { cmd.Stdin = exe.stdin cmd.Stdout = exe.stdout diff --git a/pkg/exec/xsys.go b/pkg/exec/xsys.go new file mode 100644 index 000000000..f3970bf05 --- /dev/null +++ b/pkg/exec/xsys.go @@ -0,0 +1,15 @@ +//go:build !windows +// +build !windows + +package exec + +import ( + "os" + "path/filepath" + + "golang.org/x/sys/unix" +) + +func (exe *executor) ExecXSys(exePath string, args []string) error { + return unix.Exec(exePath, append([]string{filepath.Base(exePath)}, args...), os.Environ()) //nolint:wrapcheck +} diff --git a/pkg/exec/xsys_windows.go b/pkg/exec/xsys_windows.go new file mode 100644 index 000000000..69a204a8f --- /dev/null +++ b/pkg/exec/xsys_windows.go @@ -0,0 +1,12 @@ +//go:build windows +// +build windows + +package exec + +import "errors" + +var errXSysNotSuppported = errors.New("Windows doesn't support AQUA_EXPERIMENTAL_X_SYS_EXEC") + +func (exe *executor) ExecXSys(exePath string, args []string) error { + return errXSysNotSuppported +}