summaryrefslogtreecommitdiff
path: root/vendor/github.com/mattn/go-shellwords/util_posix.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mattn/go-shellwords/util_posix.go')
-rw-r--r--vendor/github.com/mattn/go-shellwords/util_posix.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/mattn/go-shellwords/util_posix.go b/vendor/github.com/mattn/go-shellwords/util_posix.go
new file mode 100644
index 000000000..eaf1011d6
--- /dev/null
+++ b/vendor/github.com/mattn/go-shellwords/util_posix.go
@@ -0,0 +1,22 @@
+// +build !windows,go1.6
+
+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 {
+ if eerr, ok := err.(*exec.ExitError); ok {
+ b = eerr.Stderr
+ }
+ return "", errors.New(err.Error() + ":" + string(b))
+ }
+ return strings.TrimSpace(string(b)), nil
+}