1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:00:23 -07:00

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>
This commit is contained in:
Richard Musiol 2018-11-20 21:49:41 +01:00 committed by Richard Musiol
parent f8c2f4f111
commit aff2f6ece8

View File

@ -61,6 +61,11 @@
err.code = "ENOSYS";
callback(err);
},
read(fd, buffer, offset, length, position, callback) {
const err = new Error("not implemented");
err.code = "ENOSYS";
callback(err);
},
fsync(fd, callback) {
callback(null);
},