diff options
author | Russ Cox <rsc@golang.org> | 2010-07-14 17:25:46 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-07-14 17:25:46 -0700 |
commit | e9bcbc539890020668cbd361a0d8edbb8f6ab8a1 (patch) | |
tree | aee414ad934024a530358d5bcfb3c7e061b34c1c | |
parent | 9028d6bf7cb4f0a3b24e940d04945fcd89e97f3c (diff) | |
download | go-e9bcbc539890020668cbd361a0d8edbb8f6ab8a1.tar.gz go-e9bcbc539890020668cbd361a0d8edbb8f6ab8a1.zip |
os: use /tmp again
R=adg
CC=golang-dev
https://golang.org/cl/1823041
-rw-r--r-- | src/pkg/os/os_test.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/pkg/os/os_test.go b/src/pkg/os/os_test.go index 65a99355ff..9b206d0c6f 100644 --- a/src/pkg/os/os_test.go +++ b/src/pkg/os/os_test.go @@ -11,6 +11,7 @@ import ( "io/ioutil" . "os" "strings" + "syscall" "testing" ) @@ -56,7 +57,13 @@ func size(name string, t *testing.T) int64 { func newFile(testName string, t *testing.T) (f *File) { // Use a local file system, not NFS. - f, err := ioutil.TempFile("", "_Go_"+testName) + // On Unix, override $TMPDIR in case the user + // has it set to an NFS-mounted directory. + dir := "" + if syscall.OS != "windows" { + dir = "/tmp" + } + f, err := ioutil.TempFile(dir, "_Go_"+testName) if err != nil { t.Fatalf("open %s: %s", testName, err) } |