File: util_windows.go

package info (click to toggle)
golang-github-mattn-go-shellwords 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, experimental, sid
  • size: 76 kB
  • ctags: 25
  • sloc: makefile: 4
file content (17 lines) | stat: -rw-r--r-- 317 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
}