mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
8b3759eae1
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
24 lines
421 B
Go
24 lines
421 B
Go
// +build !go1.6
|
|
|
|
package shellwords
|
|
|
|
import (
|
|
"os"
|
|
"os/exec"
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
func shellRun(line string) (string, error) {
|
|
var b []byte
|
|
var err error
|
|
if runtime.GOOS == "windows" {
|
|
b, err = exec.Command(os.Getenv("COMSPEC"), "/c", line).Output()
|
|
} else {
|
|
b, err = exec.Command(os.Getenv("SHELL"), "-c", line).Output()
|
|
}
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return strings.TrimSpace(string(b)), nil
|
|
}
|