From a76f0eda93447f58dcfd37c273676829e87910a7 Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Sat, 19 Dec 2015 21:02:34 +0100 Subject: [PATCH] Use CWD for temp files, and fall back to /tmp only for upstream tests. --- tool.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tool.go b/tool.go index 1e6123c97..3786797be 100644 --- a/tool.go +++ b/tool.go @@ -223,7 +223,10 @@ func main() { return fmt.Errorf("gopherjs run: no go files listed") } - tempfile, err := ioutil.TempFile("", filepath.Base(args[0])+".") + tempfile, err := ioutil.TempFile(currentDirectory, filepath.Base(args[0])+".") + if err != nil && strings.HasPrefix(currentDirectory, runtime.GOROOT()) { + tempfile, err = ioutil.TempFile("", filepath.Base(args[0])+".") + } if err != nil { return err } @@ -363,7 +366,7 @@ func main() { return err } - tempfile, err := ioutil.TempFile("", "test.") + tempfile, err := ioutil.TempFile(currentDirectory, "test.") if err != nil { return err }