Ko\ProcessManager::demonize PHP Method

demonize() public method

Forks the currently running process to detach from console.
public demonize ( )
    public function demonize()
    {
        $pid = pcntl_fork();
        if (-1 === $pid) {
            throw new \RuntimeException('Failure on pcntl_fork');
        }
        if ($pid) {
            exit(0);
        }
        return $this;
    }

Usage Example

Beispiel #1
0
 protected function demonize()
 {
     if ($this->shouldDemonize()) {
         $this->processManager->demonize();
     }
 }
All Usage Examples Of Ko\ProcessManager::demonize