aboutsummaryrefslogtreecommitdiff
path: root/misc/wasm
diff options
context:
space:
mode:
authorRichard Musiol <mail@richard-musiol.de>2018-10-08 17:52:52 +0200
committerBrad Fitzpatrick <bradfitz@golang.org>2018-10-08 18:33:23 +0000
commite99082fc409234ebfe4683f488c9b1f41278cf0a (patch)
tree61dcd0f6fbb966b5f01f9053108cdc201e2923b8 /misc/wasm
parent26d22609c389cd9b5a21939183b6411e5861e16b (diff)
downloadgo-e99082fc409234ebfe4683f488c9b1f41278cf0a.tar.gz
go-e99082fc409234ebfe4683f488c9b1f41278cf0a.zip
misc/wasm: fix fs operations in browser
The commit 0e4c013 changed the syscall package so it uses the asynchronous functions of Node.js's fs module. This commit adapts the stubs of the fs module which are used when using a browser instead of Node.js. Fixes #28068. Change-Id: Ic3a6a8aebb0db06402383bc2fea7642a4501e02c Reviewed-on: https://go-review.googlesource.com/c/140537 Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'misc/wasm')
-rw-r--r--misc/wasm/wasm_exec.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/misc/wasm/wasm_exec.js b/misc/wasm/wasm_exec.js
index 94b9552c59..815b3fbeff 100644
--- a/misc/wasm/wasm_exec.js
+++ b/misc/wasm/wasm_exec.js
@@ -47,10 +47,17 @@
}
return buf.length;
},
- openSync(path, flags, mode) {
+ write(fd, buf, offset, length, position, callback) {
+ if (offset !== 0 || length !== buf.length || position !== null) {
+ throw new Error("not implemented");
+ }
+ const n = this.writeSync(fd, buf);
+ callback(null, n);
+ },
+ open(path, flags, mode, callback) {
const err = new Error("not implemented");
err.code = "ENOSYS";
- throw err;
+ callback(err);
},
};
}