Skip to content

Commit a0edb0c

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

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

misc/wasm/wasm_exec.js

Lines changed: 5 additions & 0 deletions
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)