<p>Hi Vincent & Eliot,</p>
<blockquote>
<p>What do you mean by broken? Do you have an example I can reproduce?</p>
</blockquote>
<p>Sure - if you start PharoConsole.exe from within a cygwin (mintty)<br>
terminal and remove the #isWin32 block from Stdio<br>
class>>standardIOStreamNamed:forWrite: so that you are actually using<br>
stdout, and then attempt to write something to stdout you'll get a<br>
primitive failure.  The same sequence works from a dos box (cmd.exe).</p>
<p>That's because the read and write primitives rely on the Windows<br>
ReadConsole() and WriteConsole() functions, which only work in a dos<br>
box, not in mintty.</p>
<p>When we started these modifications I assumed that it would be possible<br>
to have I/O that worked in both cygwin (mintty) and a dos box (cmd.exe).<br>
However on further reading it looks like MingW programs (which use<br>
either Windows functions such as ReadConsole() and WriteConsole() or<br>
the MS posix implementation) will only work properly in a dos box.  If<br>
you want proper mintty support you need to use the cygwin implementation<br>
of the posix functions.</p>
<p>As an example, attempting to use the MingW/MS fread() function and<br>
signal EOF:</p>
<ul>
<li>In a dos box, typing Control-Z correctly signals EOF.</li>
<li>In a cygwin terminal (mintty), Control-D is never passed to the<br>
program, so EOF is never true. (If you then type Control-C to<br>
terminate the program, sometimes the terminal then consumes the<br>
earlier Control-D and logs you out :-().</li>
</ul>
<p>Someone please explain how I am wrong and how to get stdio working on<br>
both dos boxes and cygwin terminals...</p>
<p>Thanks,<br>
Alistair</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384764181">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AhLyW3RnOb3Kx5abJTG0W5ijYX8WoLIJks5tsiGLgaJpZM4Tg0qx">mute the thread</a>.<img src="https://github.com/notifications/beacon/AhLyW9NbauCOpLba1jNIm4bTmA0zJ60Pks5tsiGLgaJpZM4Tg0qx.gif" height="1" width="1" alt="" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384764181"></link>
  <meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/OpenSmalltalk/opensmalltalk-vm","title":"OpenSmalltalk/opensmalltalk-vm","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm"}},"updates":{"snippets":[{"icon":"PERSON","message":"@akgrant43 in #254: Hi Vincent \u0026 Eliot,\r\n\r\n\u003e What do you mean by broken? Do you have an example I can reproduce?\r\n\r\nSure - if you start PharoConsole.exe from within a cygwin (mintty) \r\nterminal and remove the #isWin32 block from Stdio \r\nclass\u003e\u003estandardIOStreamNamed:forWrite: so that you are actually using \r\nstdout, and then attempt to write something to stdout you'll get a \r\nprimitive failure.  The same sequence works from a dos box (cmd.exe).\r\n\r\nThat's because the read and write primitives rely on the Windows \r\nReadConsole() and WriteConsole() functions, which only work in a dos \r\nbox, not in mintty.\r\n\r\nWhen we started these modifications I assumed that it would be possible \r\nto have I/O that worked in both cygwin (mintty) and a dos box (cmd.exe).  \r\nHowever on further reading it looks like MingW programs (which use \r\neither Windows functions such as ReadConsole() and WriteConsole() or \r\nthe MS posix implementation) will only work properly in a dos box.  If \r\nyou want proper mintty support you need to use the cygwin implementation \r\nof the posix functions.\r\n\r\nAs an example, attempting to use the MingW/MS fread() function and \r\nsignal EOF:\r\n\r\n- In a dos box, typing Control-Z correctly signals EOF.\r\n- In a cygwin terminal (mintty), Control-D is never passed to the \r\n  program, so EOF is never true. (If you then type Control-C to \r\n  terminate the program, sometimes the terminal then consumes the \r\n  earlier Control-D and logs you out :-().\r\n\r\nSomeone please explain how I am wrong and how to get stdio working on \r\nboth dos boxes and cygwin terminals...\r\n\r\nThanks,\r\nAlistair\r\n"}],"action":{"name":"View Pull Request","url":"https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254#issuecomment-384764181"}}}</script>