Files
zyedidia.micro/cmd/micro/shellwords/util_windows.go
Zachary Yedidia 7f287b62fb Fix autocomplete behavior for empty args
This also adds a modified version of go-shellwords as a dependency
and removes the dependency on the original go-shellwords.
2017-11-23 23:04:32 -05:00

21 lines
385 B
Go

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 {
if eerr, ok := err.(*exec.ExitError); ok {
b = eerr.Stderr
}
return "", errors.New(err.Error() + ":" + string(b))
}
return strings.TrimSpace(string(b)), nil
}