[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Add accurate check for console stdio + add associated primitive (#254)

akgrant43 notifications at github.com
Tue Apr 24 05:34:26 UTC 2018


Hi Vincent,

Just based on a quick visual inspection of the code:

- It looks like on Unix sqStdioDescriptorIsATTY() checks stdin, while on Windows it checks stdout, which is a bit inconsistent and they can be redirected independently anyway.  Why not pass an argument allowing the user to specify which file to check (0, 1, 2)?
- We'll want to modify sqFileStdioHandlesInto() in sqWin32FilePrims.c to use the new check (instead of GetConsoleMode()).
- Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time.
- sqFileAtEnd() on Windows just assumes that stdin is never at EOF if it is a terminal.  I don't know how EOF is signalled in a terminal on Windows (Ctrl-D?), but we could also improve this (although maybe this can be a separate PR).

Thanks!
Alistair


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-383808814
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180423/f76de57c/attachment.html>


More information about the Vm-dev mailing list