capturing stdout and stderr?

M

Mike

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top