mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
f2614f2107
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
19 lines
335 B
Go
19 lines
335 B
Go
// +build !windows
|
|
|
|
package shellwords
|
|
|
|
import (
|
|
"errors"
|
|
"os"
|
|
"os/exec"
|
|
"strings"
|
|
)
|
|
|
|
func shellRun(line string) (string, error) {
|
|
shell := os.Getenv("SHELL")
|
|
b, err := exec.Command(shell, "-c", line).Output()
|
|
if err != nil {
|
|
return "", errors.New(err.Error() + ":" + string(b))
|
|
}
|
|
return strings.TrimSpace(string(b)), nil
|
|
}
|