Symfony\Component\Process\Process::getPid PHP Method

getPid() public method

Returns the Pid (process identifier), if applicable.
public getPid ( ) : integer | null
return integer | null The process id if running, null otherwise
    public function getPid()
    {
        return $this->isRunning() ? $this->processInformation['pid'] : null;
    }

Usage Example

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $procApp = $input->getArgument('procApp');
     $procCall = $input->getArgument('procCall');
     $procArgs = $input->getArgument('processArgs');
     $cmd = 'php ' . $procApp . ' ' . $procCall . ' ' . implode(' ', $procArgs);
     $process = new Process($cmd);
     $process->start();
     echo 'PID: ' . $process->getPid() . "\n";
 }
All Usage Examples Of Symfony\Component\Process\Process::getPid