Skip to content

Commit

Permalink
Merge pull request #852 from aquaproj/fix/disable-xsys-on-windows
Browse files Browse the repository at this point in the history
fix: stop using "golang.org/x/sys/unix" on Windows
  • Loading branch information
suzuki-shunsuke committed Jun 12, 2022
2 parents ff56b9e + 71770eb commit e5e654f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
6 changes: 0 additions & 6 deletions pkg/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions pkg/exec/xsys.go
Original file line number Diff line number Diff line change
@@ -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
}
12 changes: 12 additions & 0 deletions pkg/exec/xsys_windows.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit e5e654f

Please sign in to comment.