Skip to content

Commit aff2f6e

Browse files
neelanceRichard Musiol
authored and
Richard Musiol
committed
misc/wasm: add stub for fs.read on browsers
Using fmt.Scanln in a browser environment caused a panic, since there was no stub for fs.read. This commit adds a stub that returns ENOSYS. Fixes #27773. Change-Id: I79b019039e4bc90da51d71a4edddf3bd7809ff45 Reviewed-on: https://go-review.googlesource.com/c/150617 Run-TryBot: Richard Musiol <neelance@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
1 parent f8c2f4f commit aff2f6e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

misc/wasm/wasm_exec.js

+5
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
err.code = "ENOSYS";
6262
callback(err);
6363
},
64+
read(fd, buffer, offset, length, position, callback) {
65+
const err = new Error("not implemented");
66+
err.code = "ENOSYS";
67+
callback(err);
68+
},
6469
fsync(fd, callback) {
6570
callback(null);
6671
},

0 commit comments

Comments
 (0)