-
Notifications
You must be signed in to change notification settings - Fork 59
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
Provide Sink/Source implementations writing to stdout/reading from stdin #375
Comments
Very welcomed enhancement. I was considering implementing this kind of project, and having stdin and stdout for Native implemented here would definitely make my life easier. stderr would also be useful. |
On |
|
Another option to consider: if these stdin/out/err
Instead, it would be:
|
For the browser I'd just avoid implementing it for the first iteration, let's see how usable the outcome is first. |
Yeap, for NodeJs everything works with existing |
It looks like you'll just have to create secondary constructors. I see that the Node.js version uses |
When re-doing |
On a side note, we might be able to finally address the annoying windows console encoding issue |
Then we have to use some alternative buffering implementation as the current one prefetch data eagerly. |
However, that'll work until the first
Yet another issue is that |
After some discussions, it seems like the fact that stdin-backed
It's worth mentioning that such a source won't replace something similar to Java's The same considerations are also applicable to stdout/err-backed Sinks. |
Other questions, however, remain open:
|
I'm a pretty strong "no" on this. The analogous behavior on the JVM would be calling This problem isn't limited to the JVM. If you close the stdin FD on native, the next opened file will get the "standard" STDIN FD number. |
It seems to be the same as
So if we want not to follow, on native a duplicate FD is needed. As a bonus, duplicating an FD will solve an issue with accidentally closing a stdin/out/err stream. |
Some applications may require reading from stdin or writing to stdout, but there's no built-in factories/functions returning corresponding
Sink
/Source
implementations.It should be trivial to provide them for all targets except JS running in the browser.
For the latter, we can return an always-exhausted
Source
and aSink
writing toconsole.log
.The text was updated successfully, but these errors were encountered: