Skip to content
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

wasi-js: warnings are printed to stdout #62

Open
gerdstolpmann opened this issue Feb 28, 2023 · 5 comments
Open

wasi-js: warnings are printed to stdout #62

gerdstolpmann opened this issue Feb 28, 2023 · 5 comments

Comments

@gerdstolpmann
Copy link

Hello,

I just switched from wasmer to wasi-js in the WasiCaml project (https://github.com/remixlabs/wasicaml). There are a lot of scripts running WASI-fied wasm code, and some of them also write to stdout. I found in the stdout of one script the string

cpu waiting for stdin: please define a way to sleep!

which causes the further build to fail. Obviously, this warning is from wasi-js and printed with console.log which goes to stdout. For scripting, this is very unfortunate - whereas messages in stderr are typically no problem. Can you switch to console.warn or console.error instead?

Btw, thanks for picking the code up and maintaining it.

@gerdstolpmann
Copy link
Author

Looks like that there is a workaround: assign

console.log = console.error

just before starting wasm.

@gerdstolpmann
Copy link
Author

gerdstolpmann commented Feb 28, 2023

Another remark: I got this warning when redirecting stdin to a file. The warning seems to be fairly inappropriate in this case - files never block. It might be better to move the warning a few lines downwards, where you call shortPause.

@williamstein
Copy link
Contributor

Can you send me a PR changing to warn? I'm happy to quickly review it, merge it, and update the npm package.

And I agree with you and see how that output could be annoying. It was something I put in to avoid problems with my interactive REPL work (for https://cowasm.org and https://cowasm.sh) that builds on this. However, it's fine to change
it to console.warn, console.error, or even remove it, at at this point.

Thanks for using wasi-js!

@williamstein
Copy link
Contributor

@gerdstolpmann
Copy link
Author

I'll take a look later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants