in reply to Re^2: Executing a process in the background AND getting its pid
in thread Executing a process in the background AND getting its pid
exec replaces the current process with the new process. Especially, this means that the PID will remain the same. If your P command really is a shell script that calls the P executable with some additional parameters, you will need to be more crafty about obtaining the PID. If you have the unix toolset available (and you should, if you're doing fork+exec), then you can look for the PID via the ps program, for example. Maybe you can also have your P process log to STDOUT instead of a logfile and use IPC::Open2 or IPC::Open3 or IPC::Run to monitor the logfile.
|
|---|