Skip to content

Commit d7183ca

Browse files
neelanceRichard Musiol
authored andcommitted
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 1135071 commit d7183ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

misc/wasm/wasm_exec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@
442442

443443
const go = new Go();
444444
go.argv = process.argv.slice(2);
445-
go.env = process.env;
445+
go.env = Object.assign({ TMPDIR: require("os").tmpdir() }, process.env);
446446
go.exit = process.exit;
447447
WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => {
448448
process.on("exit", (code) => { // Node.js exits if no callback is pending

0 commit comments

Comments
 (0)