kompose/vendor/github.com/mattn/go-shellwords/util_windows.go
Suraj Narwade bd53d8b4ba Updated vendoring
Updated vendoring for getting changes from docker/cli
for build key in v3
(since docker/cli#481 is merged now)
2017-09-26 19:37:24 +05:30

21 lines
385 B
Go

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
}