There are a few programs around, that don't behave well with pipes, when they were meant to be run from a terminal. Maybe you have one there?

Some commonly tried approaches are usually attempted. First try a sysread instead of <> on $reader, and use IO::Select to detect data in the pipeline.

#pseudocode my $data while ($select->can_read){ if ( (my $length = sysread $reader, $data, 4096) > 0) { # do something with $data } }

You might also want to test out a different IPC module, which may work better than IPC2. See I got IPC::Open3 to work! and Script hangs when called via IPC::Open3 and IPC3 buffer limit problem and Script hangs when called via IPC::Open3 for example.

The IPC3 links above have code showing how to combine IO::Select with sysread....... that is your best first shot. The basic idea should work with IPC2 also. The last resort, if select and sysread fail, is to use a pty, like in Re: monitoring memory load.

We really need to know what this program does. What does it expect on input, and what output does it deliver? Somehow, your data just sits in the pipeline buffer. You might also try the Expect module.


I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku

In reply to Re^3: Networking without a network by zentara
in thread Networking without a network by Anonymous Monk

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.