Skip to content

Commit a76f0ed

Browse files
committed
Use CWD for temp files, and fall back to /tmp only for upstream tests.
1 parent 40d8f04 commit a76f0ed

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tool.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@ func main() {
223223
return fmt.Errorf("gopherjs run: no go files listed")
224224
}
225225

226-
tempfile, err := ioutil.TempFile("", filepath.Base(args[0])+".")
226+
tempfile, err := ioutil.TempFile(currentDirectory, filepath.Base(args[0])+".")
227+
if err != nil && strings.HasPrefix(currentDirectory, runtime.GOROOT()) {
228+
tempfile, err = ioutil.TempFile("", filepath.Base(args[0])+".")
229+
}
227230
if err != nil {
228231
return err
229232
}
@@ -363,7 +366,7 @@ func main() {
363366
return err
364367
}
365368

366-
tempfile, err := ioutil.TempFile("", "test.")
369+
tempfile, err := ioutil.TempFile(currentDirectory, "test.")
367370
if err != nil {
368371
return err
369372
}

0 commit comments

Comments
 (0)