in reply to Listening to a child for a while, then passing its output along

Check out Bidirectional Communication with ... (part of perlipc).

cp
----
"Never be afraid to try something new. Remember, amateurs built the ark. Professionals built the Titanic."

  • Comment on Re: Listening to a child for a while, then passing its output along

Replies are listed 'Best First'.
Re: Re: Listening to a child for a while, then passing its output along
by antifun (Sexton) on May 21, 2003 at 18:21 UTC

    This doesn't answer any of my questions, sadly. Here's a short version of them, restated:

    • Is there any way to "merge" file descriptors without doing any manual copying of data? That is, can you do something like
      open(CHILD_STDOUT, ">&STDOUT"); open(CHILD_STDERR, ">&STDERR");
      without screwing up the the real filehandles? (This would effect a passthrough of the child's stdout and stderr.)
    • What is the best (or a good) way to drop into an existing Perl/Tk program a routine that echoes child output as described above? Fileevents will probably work for this, but does anyone have any other ideas?

    The link you gave tells me what I already know how to do -- open a child and listen to its output. What I need to do is stop listening at some point, while letting the child continue, and echoing whatever else it says after that point to whoever might be listening to my STDOUT or STDERR.


    ---
    "I hate it when I think myself into a corner."
    Matt Mitchell