-
Notifications
You must be signed in to change notification settings - Fork 18
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
Console.readAll blocks until EOF #20
Comments
I'm not sure how to do that. WASI doesn't expose anything about the underlying environment, so we don't know what an end of line looks like. |
I guess it relate to this discussion: WebAssembly/WASI#162 |
If we can assume that a newline always ends with LF regardless of the platform, then But I do not know, whether there are any use cases where recognizing the CR character might be necessary. |
I had a look at the ReadLine implementation of Go and they simply skip the CR (\r) character as well, if it is followed by a LF (\n): bufio.go. |
But then, we have a similar problem with the |
It seems that Go always writes '\n', regardless of the platform. For console output this is probably fine, although I did not yet check what happens when stdout is redirected to a file in Windows. |
The Console.readAll function blocks until the EOF character is entered (e.g. by pressing CTRL-D in a linux shell), so it is not that useful for a CLI application.
It would be great if there was a function which reads a whole line until a newline character is entered (e.g. Console.readLine).
For portability this should probably take different newline character sequences into account (e.g. CR+LF for Windows and only LF for Linux/macOS).
The text was updated successfully, but these errors were encountered: