aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Minnich <rminnich@gmail.com>2017-08-29 09:59:27 -0700
committerDaniel Martí <mvdan@mvdan.cc>2017-08-29 20:08:16 +0000
commit0cf7e54f2fe033a1e596d9aaed0e728cda1fc5e7 (patch)
tree64665fae739b3c0ba61738e67792a949cff6f2b9
parentae84aaee44f0d978ea6906812ee73fc2bc6297c8 (diff)
downloadgo-0cf7e54f2fe033a1e596d9aaed0e728cda1fc5e7.tar.xz
os: don't assume /bin/pwd in test, find it in $PATH
There are several distros now that no longer have /bin. Instead of assuming /bin/pwd, we will look for it in $PATH. Fixes #21684. Change-Id: I61478326500edeadc3c26803990550dad00c7971 Signed-off-by: Ron Minnich <rminnich@gmail.com> Reviewed-on: https://go-review.googlesource.com/60010 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/os/os_test.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/os/os_test.go b/src/os/os_test.go
index dbe4ff8830..c807786310 100644
--- a/src/os/os_test.go
+++ b/src/os/os_test.go
@@ -1014,9 +1014,14 @@ func TestStartProcess(t *testing.T) {
dir = Getenv("SystemRoot")
args = []string{"/c", "cd"}
default:
- cmd = "/bin/pwd"
+ var err error
+ cmd, err = osexec.LookPath("pwd")
+ if err != nil {
+ t.Fatalf("Can't find pwd: %v", err)
+ }
dir = "/"
args = []string{}
+ t.Logf("Testing with %v", cmd)
}
cmddir, cmdbase := filepath.Split(cmd)
args = append([]string{cmdbase}, args...)