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

Eliot Miranda eliot.miranda at gmail.com
Thu Apr 26 20:24:43 UTC 2018


Hi Alistair,


> On Apr 26, 2018, at 12:35 PM, akgrant43 <notifications at github.com> wrote:
> 
> 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...
> 

Ugh.  I didn't realize one couldn't use the same code in both :-(.  I guess we have to test to find out what the context is and use dread in one and ReadConsole in the other.  But I don't get it.  IIRC, it used to be the case that ReadConsole/WriteConsole worked in both.
> Thanks,
> Alistair
> 
>> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or mute the thread.
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180426/f2ca7be8/attachment-0001.html>


More information about the Vm-dev mailing list