Commit b7582852 authored by Alex Brainman's avatar Alex Brainman

gotest, pkg/exec: use bash instead of sh to execute shell scripts on windows

As suggested by dho, iant2.

R=golang-dev, rsc
CC=devon.odell, golang-dev, iant
https://golang.org/cl/4515147
parent f369fc09
...@@ -285,8 +285,8 @@ func doRun(argv []string, returnStdout bool) string { ...@@ -285,8 +285,8 @@ func doRun(argv []string, returnStdout bool) string {
} }
cmd += `"` + v + `"` cmd += `"` + v + `"`
} }
command = "sh" command = "bash"
argv = []string{"sh", "-c", cmd} argv = []string{"bash", "-c", cmd}
} }
var err os.Error var err os.Error
argv[0], err = exec.LookPath(argv[0]) argv[0], err = exec.LookPath(argv[0])
......
...@@ -39,7 +39,7 @@ func TestRunCat(t *testing.T) { ...@@ -39,7 +39,7 @@ func TestRunCat(t *testing.T) {
} }
func TestRunEcho(t *testing.T) { func TestRunEcho(t *testing.T) {
cmd, err := run([]string{"sh", "-c", "echo hello world"}, cmd, err := run([]string{"bash", "-c", "echo hello world"},
DevNull, Pipe, DevNull) DevNull, Pipe, DevNull)
if err != nil { if err != nil {
t.Fatal("run:", err) t.Fatal("run:", err)
...@@ -57,7 +57,7 @@ func TestRunEcho(t *testing.T) { ...@@ -57,7 +57,7 @@ func TestRunEcho(t *testing.T) {
} }
func TestStderr(t *testing.T) { func TestStderr(t *testing.T) {
cmd, err := run([]string{"sh", "-c", "echo hello world 1>&2"}, cmd, err := run([]string{"bash", "-c", "echo hello world 1>&2"},
DevNull, DevNull, Pipe) DevNull, DevNull, Pipe)
if err != nil { if err != nil {
t.Fatal("run:", err) t.Fatal("run:", err)
...@@ -75,7 +75,7 @@ func TestStderr(t *testing.T) { ...@@ -75,7 +75,7 @@ func TestStderr(t *testing.T) {
} }
func TestMergeWithStdout(t *testing.T) { func TestMergeWithStdout(t *testing.T) {
cmd, err := run([]string{"sh", "-c", "echo hello world 1>&2"}, cmd, err := run([]string{"bash", "-c", "echo hello world 1>&2"},
DevNull, Pipe, MergeWithStdout) DevNull, Pipe, MergeWithStdout)
if err != nil { if err != nil {
t.Fatal("run:", err) t.Fatal("run:", err)
...@@ -97,7 +97,7 @@ func TestAddEnvVar(t *testing.T) { ...@@ -97,7 +97,7 @@ func TestAddEnvVar(t *testing.T) {
if err != nil { if err != nil {
t.Fatal("setenv:", err) t.Fatal("setenv:", err)
} }
cmd, err := run([]string{"sh", "-c", "echo $NEWVAR"}, cmd, err := run([]string{"bash", "-c", "echo $NEWVAR"},
DevNull, Pipe, DevNull) DevNull, Pipe, DevNull)
if err != nil { if err != nil {
t.Fatal("run:", err) t.Fatal("run:", err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment