Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Howdy monks,

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.

perl -MIPC::Open3 -e "open3(\*IN,'>&STDOUT','>&STDERR',qw[perl -pe 1]) +;print IN 'Hello';close IN;wait"
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 perl -pe 1. Around it is wrapped a call to open3, and the caller prints in a string, closes IN, which should generate an EOF for the child... but it never happens.

I have tried printing a multi-line string, reading just one line with "readline" or "scalar <>" 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.

I am about to go to bed, and in the morning will just use open("|cmd") 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)

thanks, and sorry for brain cells lost, in advance


In reply to IPC::Open3 STDIN never sees eof on win32? by Yary

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (9)
    As of 2014-08-28 08:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (258 votes), past polls