mirror of
https://github.com/golang/go
synced 2024-11-19 12:24:42 -07:00
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>
This commit is contained in:
parent
ae84aaee44
commit
0cf7e54f2f
@ -1014,9 +1014,14 @@ func TestStartProcess(t *testing.T) {
|
|||||||
dir = Getenv("SystemRoot")
|
dir = Getenv("SystemRoot")
|
||||||
args = []string{"/c", "cd"}
|
args = []string{"/c", "cd"}
|
||||||
default:
|
default:
|
||||||
cmd = "/bin/pwd"
|
var err error
|
||||||
|
cmd, err = osexec.LookPath("pwd")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Can't find pwd: %v", err)
|
||||||
|
}
|
||||||
dir = "/"
|
dir = "/"
|
||||||
args = []string{}
|
args = []string{}
|
||||||
|
t.Logf("Testing with %v", cmd)
|
||||||
}
|
}
|
||||||
cmddir, cmdbase := filepath.Split(cmd)
|
cmddir, cmdbase := filepath.Split(cmd)
|
||||||
args = append([]string{cmdbase}, args...)
|
args = append([]string{cmdbase}, args...)
|
||||||
|
Loading…
Reference in New Issue
Block a user