File: util_posix.go

package info (click to toggle)
aptly 0.9.7-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 78,272 kB
  • sloc: python: 7,998; xml: 4,781; asm: 3,286; sh: 1,188; makefile: 278; ruby: 193; ansic: 127
file content (19 lines) | stat: -rw-r--r-- 335 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// +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
}