]> Cypherpunks.ru repositories - gostls13.git/commitdiff
misc/wasm: fix panic on os.Stdout.Sync() in the browser
authorNick Craig-Wood <nick@craig-wood.com>
Thu, 18 Oct 2018 15:26:56 +0000 (16:26 +0100)
committerRichard Musiol <neelance@gmail.com>
Sat, 20 Oct 2018 12:11:14 +0000 (12:11 +0000)
Before this change running os.Stdout.Sync() in the browser would panic
the application with:

panic: syscall/js: Value.Call: property fsync is not a function, got undefined

Afterwards Sync() becomes a noop for compatibility reasons.

Change-Id: I1fcef694beb35fdee3173f87371e1ff233b15d32
Reviewed-on: https://go-review.googlesource.com/c/143138
Reviewed-by: Richard Musiol <neelance@gmail.com>
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

misc/wasm/wasm_exec.js

index bd9754e53a354f982084fd4eaf43800a0ab33738..78eb306253d669fa7a0fb362c59b4e3a815a5b33 100644 (file)
@@ -59,6 +59,9 @@
                                err.code = "ENOSYS";
                                callback(err);
                        },
+                       fsync(fd, callback) {
+                               callback(null);
+                       },
                };
        }