You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use Sys.stdin().readAll to read all data from stdin (passed by e.g. node run.js < file.txt). Apparently the last readBytes call returns 0 which prompts haxe.io.Input to throw a Blocked exception (throwing away all bytes read so far - which might not be ideal).
I haven't found any documentation for node's readSync function that talks about exceptions it might throw - I don't even know if throwing exceptions is a thing in NodeJS. But I fear Eof is never thrown, meaning any data read from stdin gets discarded.
I know that technically stdin might receive a constant stream of data, with no clear EOF in sight, so using readAll is definitely not an option in those situations and blocking is probably the correct response. Although loosing all input might not be very helpful.
I don't know if there's more places that use FileInput and if they throw a proper Eof exception when exhausting input, but at least in stdin's case it misbehaves.
The text was updated successfully, but these errors were encountered:
Sys.stdin().readUntil() and Sys.stdin().readLine() seem to cause infinite loops at EOF because they expect Eof to be thrown but fs.readSync() just returns 0.
However I'm not sure what would be the proper way to fix this.
I am trying to use
Sys.stdin().readAll
to read all data from stdin (passed by e.g.node run.js < file.txt
). Apparently the last readBytes call returns 0 which prompts haxe.io.Input to throw a Blocked exception (throwing away all bytes read so far - which might not be ideal).I haven't found any documentation for node's readSync function that talks about exceptions it might throw - I don't even know if throwing exceptions is a thing in NodeJS. But I fear
Eof
is never thrown, meaning any data read from stdin gets discarded.I know that technically stdin might receive a constant stream of data, with no clear EOF in sight, so using readAll is definitely not an option in those situations and blocking is probably the correct response. Although loosing all input might not be very helpful.
I don't know if there's more places that use FileInput and if they throw a proper
Eof
exception when exhausting input, but at least in stdin's case it misbehaves.The text was updated successfully, but these errors were encountered: