Skip to content

Commit

Permalink
os: don't assume /bin/pwd in test, find it in $PATH
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-on: https://go-review.googlesource.com/60010
Reviewed-by: Daniel Martí <[email protected]>
Run-TryBot: Daniel Martí <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
rminnich authored and mvdan committed Aug 29, 2017
1 parent ae84aae commit 0cf7e54
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/os/os_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down

0 comments on commit 0cf7e54

Please sign in to comment.