On 9/18/06, David Golden <[EMAIL PROTECTED]> wrote:
demerphq wrote:
> On 9/18/06, Ovid <[EMAIL PROTECTED]> wrote:
>> I've gotten a report that the open command fails on Windows. Not a
>> surprise, now that I think about it. However, I don't know of any
>> portable way of forcing STDERR to STDOUT (and I don't have a Windows
>> box handy). This means that my 2000+ TAPx::Parser tests are in
>> trouble. If Test::Builder accepted an environment variable which
>> allowed me to override this, I might have a way out. So far removing
>> the 2>&1 seems to make my tests pass on a Linux box, but that strikes
>> me as bizarre as I thought STDERR wouldn't get read that way. What
>> the heck am I misunderstanding?
>
> The easiest way I know of to execute a process in win32 and get both
> the stderr and stdout back is to use backticks.
>
> my $res=`$cmd 2>&1`;
I found that the suggested code for saving and restoring STDOUT and
STDERR given in "perldoc -f open" seems to work OK. This is essentially
what IPC::Run3 is doing -- capturing to an external file and then
reading it back in and making it available.
Yeah, but thats a can of worms in of itself. Using backticks is
simple, and requires no special stuff. If you dont mind blocking until
the other process completes, I see no reason to use another more
complex approach.
yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"