capturing stdout and stderr?

Discussion in 'Perl Misc' started by Mike, Aug 9, 2009.

  1. Mike

    Mike Guest

    Morning,

    I'm asking where do I start my research, recommendations for a module
    or function. I'm not asking for code that does what I need.

    I have a need to start a command then read the command's stdout and
    stderr streams, capturing each line individually, prepending 'STDOUT:'
    or 'STDERR:' to the line depending on which stream the line came from,
    then writing the line to a central log file.

    In C I would fork(), exec(), then from the parent just use select()
    to grab each line that comes from the child.

    Is the same approach the simpleist way in Perl or should I look at
    IPC::Open3 or IPC::Run?

    This script needs to run on linux, HP-UX, Solaris, IRIX, Mac OS X,
    cygwin/win32, and cygwin/win64.

    Thanks for your thoughts.

    Mike
     
    Mike, Aug 9, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vincent Touquet
    Replies:
    1
    Views:
    614
    Adrian B.
    Sep 3, 2004
  2. Vincent  Touquet
    Replies:
    0
    Views:
    460
    Vincent Touquet
    Sep 6, 2004
  3. Fuzzyman
    Replies:
    3
    Views:
    652
    Gabriel Genellina
    Jan 7, 2007
  4. ZelluX
    Replies:
    15
    Views:
    845
    Arne Vajhøj
    Jun 25, 2008
  5. ids
    Replies:
    4
    Views:
    1,541
    Keith Thompson
    Apr 14, 2009
Loading...

Share This Page