How do you capture stderr, stdout, and the exit code all at once, in Perl?

后端 未结 6 2207
情深已故
情深已故 2020-11-27 03:19

Is it possible to run an external process from Perl, capture its stderr, stdout AND the process exit code?

I seem to be able to do combinations of these, e.g. use ba

6条回答
  •  不知归路
    2020-11-27 03:44

    If you reread the documentation for IPC::Open3, you'll see a note that you should call waitpid to reap the child process. Once you do this, the status should be available in $?. The exit value is $? >> 8. See $? in perldoc perlvar.

提交回复
热议问题