diff options
author | Richard Musiol <mail@richard-musiol.de> | 2018-11-20 14:47:58 +0100 |
---|---|---|
committer | Richard Musiol <neelance@gmail.com> | 2018-11-20 15:29:09 +0000 |
commit | d7183ca40360bd5f8f1fcc199461344b6ee4de05 (patch) | |
tree | eeda121c0474bf8873b0bed647f1068040f50962 /misc | |
parent | 1135071b47b1c9c0069d384c136e94d2883282bc (diff) | |
download | go-git-d7183ca40360bd5f8f1fcc199461344b6ee4de05.tar.gz |
misc/wasm: use temporary directory provided by Node.js
os.TempDir() did not return a proper directory on Windows with js/wasm,
because js/wasm only uses the Unix variant of TempDir.
This commit passes the temporary directory provided by Node.js to the
Go runtime by adding it as a default value for the TMPDIR environment
variable. It makes TempDir compatible with all platforms.
Fixes #27306.
Change-Id: I8b17e44cfb2ca41939ab2a4f918698fe330cb8bc
Reviewed-on: https://go-review.googlesource.com/c/150437
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'misc')
-rw-r--r-- | misc/wasm/wasm_exec.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/misc/wasm/wasm_exec.js b/misc/wasm/wasm_exec.js index 440bba104c..83704a054f 100644 --- a/misc/wasm/wasm_exec.js +++ b/misc/wasm/wasm_exec.js @@ -442,7 +442,7 @@ const go = new Go(); go.argv = process.argv.slice(2); - go.env = process.env; + go.env = Object.assign({ TMPDIR: require("os").tmpdir() }, process.env); go.exit = process.exit; WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => { process.on("exit", (code) => { // Node.js exits if no callback is pending |