k3s/vendor/github.com/mattn/go-shellwords/util_windows.go
Darren Shepherd fa08d6076c Update vendor
2019-01-11 21:58:27 -07:00

23 lines
410 B
Go

// +build windows,go1.6
package shellwords
import (
"errors"
"os"
"os/exec"
"strings"
)
func shellRun(line string) (string, error) {
shell := os.Getenv("COMSPEC")
b, err := exec.Command(shell, "/c", line).Output()
if err != nil {
if eerr, ok := err.(*exec.ExitError); ok {
b = eerr.Stderr
}
return "", errors.New(err.Error() + ":" + string(b))
}
return strings.TrimSpace(string(b)), nil
}