src/AbstractDaemonApplication.php
protected function fork()
	{
		// Attempt to fork the process.
		$pid = $this->pcntlFork();

		// If the fork failed, throw an exception.
		if ($pid === -1)
		{
			throw new \RuntimeException('The process could not be forked.');
		}

		if ($pid === 0)
		{
			// Update the process id for the child.
			$this->processId = (int) posix_getpid();
		}
		else
		{
			// Log the fork in the parent.
			$this->getLogger()->debug('Process forked ' . $pid);
		}

		// Trigger the onFork event.
		$this->postFork();

		return $pid;
	}
protected function fork()
	{
		// Attempt to fork the process.
		$pid = $this->pcntlFork();

		// If the fork failed, throw an exception.
		if ($pid === -1)
		{
			throw new \RuntimeException('The process could not be forked.');
		}

		if ($pid === 0)
		{
			// Update the process id for the child.
			$this->processId = (int) posix_getpid();
		}
		else
		{
			// Log the fork in the parent.
			$this->getLogger()->debug('Process forked ' . $pid);
		}

		// Trigger the onFork event.
		$this->postFork();

		return $pid;
	}
protected function fork ( ) { // Attempt to fork the process. $ pid = $ this -> pcntlFork ( ) ; // If the fork failed, throw an exception. if ( $ pid === - 1 ) { throw new \ RuntimeException ( 'The process could not be forked.' ) ; } if ( $ pid === 0 ) { // Update the process id for the child. $ this -> processId = ( int ) posix_getpid ( ) ; } else { // Log the fork in the parent. $ this -> getLogger ( ) -> debug ( 'Process forked ' . $ pid ) ; } // Trigger the onFork event. $ this -> postFork ( ) ; return $ pid ; }
Method to fork the process.

@return  integer  The child process id to the parent process, zero to the child process.

@since   1.0
@throws  \RuntimeException
Method to fork the process .