<?xml version="1.0" encoding="windows-1252"?>
<node id="1007191" title="IPC::Open3 STDIN never sees eof on win32?" created="2012-12-04 23:15:27" updated="2012-12-04 23:15:27">
<type id="115">
perlquestion</type>
<author id="694176">
Yary</author>
<data>
<field name="doctext">
Howdy monks,
&lt;p&gt;
I've seen more than a few questions about the stdout/stderr handles with IPC::Open3, but not yet found people with the issue I'm having on stdin. Here's a one-liner that prints "Hello" on Unix, but hangs on Win32.
&lt;code&gt;
perl -MIPC::Open3 -e "open3(\*IN,'&gt;&amp;STDOUT','&gt;&amp;STDERR',qw[perl -pe 1]);print IN 'Hello';close IN;wait"
&lt;/code&gt;
It is about as simplified as I can get it. There's a subprocess which just prints everything it reads from STDIN, that's the &lt;tt&gt;perl -pe 1&lt;/tt&gt;. Around it is wrapped a call to open3, and the caller prints in a string, closes &lt;tt&gt;IN&lt;/tt&gt;, which should generate an EOF for the child... but it never happens.
&lt;p&gt;
I have tried printing a multi-line string, reading just one line with "readline" or "scalar &lt;&gt;" does work, showing that open3 is indeed communicating over IN. The child sees input written by the parent, it does not see the parent closing IN when running under Win32.
&lt;p&gt;
I am about to go to bed, and in the morning will just use &lt;tt&gt;open("|cmd")&lt;/tt&gt; with some fancy redirects to get stdout and stderr where I want to go... unless a genius can point out what I'm doing wrong/a solution... preferably using only standard modules (or those that ship with ActiveState's distribution)
&lt;p&gt;
thanks, and sorry for brain cells lost, in advance</field>
</data>
</node>
