diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/util_unix.go | 5 | ||||
-rw-r--r-- | src/util/util_windows.go | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/util/util_unix.go b/src/util/util_unix.go index dcc5cb5e..29e0d30d 100644 --- a/src/util/util_unix.go +++ b/src/util/util_unix.go @@ -15,3 +15,8 @@ func ExecCommand(command string) *exec.Cmd { } return exec.Command(shell, "-c", command) } + +// IsWindows returns true on Windows +func IsWindows() bool { + return false +} diff --git a/src/util/util_windows.go b/src/util/util_windows.go index a660f39e..3aa86606 100644 --- a/src/util/util_windows.go +++ b/src/util/util_windows.go @@ -5,6 +5,8 @@ package util import ( "os" "os/exec" + + "github.com/junegunn/go-shellwords" ) // ExecCommand executes the given command with $SHELL @@ -13,5 +15,14 @@ func ExecCommand(command string) *exec.Cmd { if len(shell) == 0 { shell = "cmd" } - return exec.Command(shell, "/c", command) + args, _ := shellwords.Parse(command) + allArgs := make([]string, len(args)+1) + allArgs[0] = "/c" + copy(allArgs[1:], args) + return exec.Command(shell, allArgs...) +} + +// IsWindows returns true on Windows +func IsWindows() bool { + return true } |