-
-
Notifications
You must be signed in to change notification settings - Fork 51
print doesn't work in any event handler #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm, I couldn't reproduce. How do you redirect stdout? Could you try that way used in IntegratedTests? const wasmFs = new WasmFs();
// Output stdout and stderr to console
const originalWriteSync = wasmFs.fs.writeSync;
wasmFs.fs.writeSync = (fd, buffer, offset, length, position) => {
const text = new TextDecoder("utf-8").decode(buffer);
switch (fd) {
case 1:
console.log(text);
break;
case 2:
console.error(text);
break;
}
return originalWriteSync(fd, buffer, offset, length, position);
}; |
This is great, thanks! Would you mind if I create a PR that adds this to |
Thanks. It would be helpful 🙏 |
MaxDesiatov
added a commit
to MaxDesiatov/JavaScriptKit
that referenced
this issue
Jun 21, 2020
Added per the discussion in swiftwasm#11.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While using
print
as a top-level invocation works, if you callprint
in any closure handler, such asonclick
,addEventListener
etc,print
output is not redirected toconsole.log
. Apparently, there isn't anything that reads from stdout and redirects toconsole.log
at that point.The text was updated successfully, but these errors were encountered: