in reply to How can I redirect STDOUT and STDERR from a program on WIN32?

I have used IPC::Open3 for this and found it worked well both on Unix and Windows. If $cmd has your command then:
use IPC::Open3; open3("<&STDIN", \*CAPTURE, \*CAPTURE, $cmd) or die "Cannot run $cmd: +$!";
Now you are reading both STDERR and STDOUT of the file from CAPTURE.

I don't know how to do this and get return codes as well though, the return of open3 is a process ID. Also note that you need to be careful with mixing filehandles. Should you try to get output while it is giving you input, programs take a while to get bored with that sort of silliness...

Replies are listed 'Best First'.
Re: Answer: How can I redirect STDOUT and STDERR from a program on WIN32?
by stdout (Initiate) on Oct 03, 2004 at 19:27 UTC
    any idea about getting the return code ? :)