Greetings, esteemed monks!

So I have been tilting at the windmill of handling STDOUT and STDERR of a child
synchronously, yet separately. I work in a Linux environment (RedHat 3 and 4 and perl 5.8.5).
I've resigned myself to getting halfway results with
sporadic attempts at refining my technique. I won't repeat myself here, but this node:

Re: Synchronizing STDERR and STDOUT

explains the current status of my efforts.

Here's an example of some output from the example child program:

<snip> <span id='stderr'>1</span> 2 <span id='stderr'>3</span> 4 <span id='stderr'>5</span> 6 8 10 12 14 16 18 <span id='stderr'>7 9 11 13 15 17 19 21 23 25 27 29 31 33 35</span> 20 <snip> 58 <span id='stderr'>37 39 <snip> 73</span> 60 62 <you get the picture>
As you can see in the code, autoflushing is turned on (in both child and parent) and the child should think it's connected to a tty.
However, the output is still buffered in chunks larger than one line.

Upon reading the whole thread that the above node is in, I found out about PerlIO and enabled logging for a run of the program.

I glanced through perlio.log and I found the following line:

/opt/perl/lib/site_perl/5.8.5/IPC/Run.pm:2613 Cannot flush f=0x805defc

here is line 2613 in my version of Run.pm:

open $s1, ">&=$self->{SYNC_WRITER_FD}" or croak "$! setting filehandle to fd SYNC_WRITER_FD" ;
I am curious about where the "Cannot flush" message originated and why. Any ideas?

Terrence

_________________________________________________________________________________

I like computer programming because it's like Legos for the mind.


In reply to Question about the guts of PerlIO and IPC::Run by OfficeLinebacker

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.