traefik/vendor/github.com/mattn/go-shellwords/util_windows.go

18 lines
317 B
Go
Raw Normal View History

2017-02-07 21:33:23 +00:00
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 {
return "", errors.New(err.Error() + ":" + string(b))
}
return strings.TrimSpace(string(b)), nil
}