Clear questions and runnable code
get the best and fastest answer
once again: program output and return codeby particle (Vicar)
|on Jun 07, 2001 at 17:14 UTC||Need Help??|
particle has asked for the
wisdom of the Perl Monks concerning the following question:
this question has been asked and answered many times. but every answer has left me wanting something more. there must be something i'm missing, what is it?
i need to capture STDOUT, STDERR, and a return code from a 3rd party executable. i have code samples below of each method. i can't include the 3rd party exe, so i wrote a little perl code~
i figured my best bet was IPC::Open3, but this does not give me the return code. even $? is set to the pid. here's a little code sample~
here's the output:
as you can see, i can capture STDOUT and STDERR fine, but i can't find a way to get the exit code. $@ is the exit code from open3, should something disasterous happen. not the exit code from the executed code 'perl return.pl'.
i also tried system, to no avail~
and here's it's output:
here i get the return code (GOOD!), but the output is not going being redirected. this looks more promising, but i'm tired so i've come for help.
the relevant links i found are listed below, for reference:
what am i missing?