Skip to content

Commit f15a4ac

Browse files
committed
Merge pull request #361 from flimzy/tempdir3
Use CWD for temp files, and fall back to /tmp only for upstream tests.
2 parents 8497b78 + a76f0ed commit f15a4ac

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
@@ -233,7 +233,10 @@ func main() {
233233
return fmt.Errorf("gopherjs run: no go files listed")
234234
}
235235

236-
tempfile, err := ioutil.TempFile("", filepath.Base(args[0])+".")
236+
tempfile, err := ioutil.TempFile(currentDirectory, filepath.Base(args[0])+".")
237+
if err != nil && strings.HasPrefix(currentDirectory, runtime.GOROOT()) {
238+
tempfile, err = ioutil.TempFile("", filepath.Base(args[0])+".")
239+
}
237240
if err != nil {
238241
return err
239242
}
@@ -373,7 +376,7 @@ func main() {
373376
return err
374377
}
375378

376-
tempfile, err := ioutil.TempFile("", "test.")
379+
tempfile, err := ioutil.TempFile(currentDirectory, "test.")
377380
if err != nil {
378381
return err
379382
}

0 commit comments

Comments
 (0)