launch process, retrieve PID, and Exit Status
At the same time? PID belongs to a running process; exit status is an int returned by terminating main(). Unless I've mistaken, you can't have both meaningful at the same time: when you have the exit status, the process is already terminated.
Anyway, have a look at IPC::Run
. Other method is to pipe
(thus you can read STDOUT), fork
(thus you get the PID), exec
in the main procss (and then use $?
to get the exit status).
Sorry if my advice was wrong.