]> Cypherpunks repositories - gostls13.git/commitdiff
gotest, pkg/exec: use bash instead of sh to execute shell scripts on windows
authorAlex Brainman <alex.brainman@gmail.com>
Sat, 28 May 2011 11:26:03 +0000 (21:26 +1000)
committerAlex Brainman <alex.brainman@gmail.com>
Sat, 28 May 2011 11:26:03 +0000 (21:26 +1000)
As suggested by dho, iant2.

R=golang-dev, rsc
CC=devon.odell, golang-dev, iant
https://golang.org/cl/4515147

src/cmd/gotest/gotest.go
src/pkg/exec/exec_test.go

index 8c81baf976d97629a38a7a6d05d7743399e97949..4cb3da23c838ee1efc7440cf30be61b72207aaa6 100644 (file)
@@ -285,8 +285,8 @@ func doRun(argv []string, returnStdout bool) string {
                        }
                        cmd += `"` + v + `"`
                }
-               command = "sh"
-               argv = []string{"sh", "-c", cmd}
+               command = "bash"
+               argv = []string{"bash", "-c", cmd}
        }
        var err os.Error
        argv[0], err = exec.LookPath(argv[0])
index eb8cd5fec9f489ba1723fe1bf9cdf8a7c1ce5474..362b41c013a51bc6cf56031e454ecb18cf1ee43c 100644 (file)
@@ -39,7 +39,7 @@ func TestRunCat(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)
        if err != nil {
                t.Fatal("run:", err)
@@ -57,7 +57,7 @@ func TestRunEcho(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)
        if err != nil {
                t.Fatal("run:", err)
@@ -75,7 +75,7 @@ func TestStderr(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)
        if err != nil {
                t.Fatal("run:", err)
@@ -97,7 +97,7 @@ func TestAddEnvVar(t *testing.T) {
        if err != nil {
                t.Fatal("setenv:", err)
        }
-       cmd, err := run([]string{"sh", "-c", "echo $NEWVAR"},
+       cmd, err := run([]string{"bash", "-c", "echo $NEWVAR"},
                DevNull, Pipe, DevNull)
        if err != nil {
                t.Fatal("run:", err)