Don't rely on sh being in the PATH on Windows for tests
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>v0.8
parent
b2d3473cba
commit
31195373cf
|
@ -4651,7 +4651,12 @@ func tmpdir(appliers ...fstest.Applier) (string, error) {
|
|||
|
||||
func runShell(dir string, cmds ...string) error {
|
||||
for _, args := range cmds {
|
||||
cmd := exec.Command("sh", "-c", args)
|
||||
var cmd *exec.Cmd
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd = exec.Command("powershell", "-command", args)
|
||||
} else {
|
||||
cmd = exec.Command("sh", "-c", args)
|
||||
}
|
||||
cmd.Dir = dir
|
||||
if err := cmd.Run(); err != nil {
|
||||
return errors.Wrapf(err, "error running %v", args)
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -392,7 +393,12 @@ func setupGitRepo(dir string) (string, error) {
|
|||
|
||||
func runShell(dir string, cmds ...string) error {
|
||||
for _, args := range cmds {
|
||||
cmd := exec.Command("sh", "-c", args)
|
||||
var cmd *exec.Cmd
|
||||
if runtime.GOOS == "windows" {
|
||||
cmd = exec.Command("powershell", "-command", args)
|
||||
} else {
|
||||
cmd = exec.Command("sh", "-c", args)
|
||||
}
|
||||
cmd.Dir = dir
|
||||
if err := cmd.Run(); err != nil {
|
||||
return errors.Wrapf(err, "error running %v", args)
|
||||
|
|
Loading…
Reference in New Issue