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

akgrant43 notifications at github.com
Thu Apr 26 19:35:40 UTC 2018


Hi Vincent & Eliot,

> What do you mean by broken? Do you have an example I can reproduce?

Sure - if you start PharoConsole.exe from within a cygwin (mintty) 
terminal and remove the #isWin32 block from Stdio 
class>>standardIOStreamNamed:forWrite: so that you are actually using 
stdout, and then attempt to write something to stdout you'll get a 
primitive failure.  The same sequence works from a dos box (cmd.exe).

That's because the read and write primitives rely on the Windows 
ReadConsole() and WriteConsole() functions, which only work in a dos 
box, not in mintty.

When we started these modifications I assumed that it would be possible 
to have I/O that worked in both cygwin (mintty) and a dos box (cmd.exe).  
However on further reading it looks like MingW programs (which use 
either Windows functions such as ReadConsole() and WriteConsole() or 
the MS posix implementation) will only work properly in a dos box.  If 
you want proper mintty support you need to use the cygwin implementation 
of the posix functions.

As an example, attempting to use the MingW/MS fread() function and 
signal EOF:

- In a dos box, typing Control-Z correctly signals EOF.
- In a cygwin terminal (mintty), Control-D is never passed to the 
  program, so EOF is never true. (If you then type Control-C to 
  terminate the program, sometimes the terminal then consumes the 
  earlier Control-D and logs you out :-().

Someone please explain how I am wrong and how to get stdio working on 
both dos boxes and cygwin terminals...

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-384764181
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180426/94386095/attachment.html>


More information about the Vm-dev mailing list