Split into a new process. Returns true when it's the child process and false
for the parent process.

@return bool
325595
private function daemonize()
    {
        // prevent permission issues
        umask(0);

        $pid = pcntl_fork();
        if ($pid == -1) {
            /* fork failed */
            throw new \RuntimeException('Failed to fork the daemon.');
        } elseif ($pid) {
            /* close the parent */
            return false;
        }

        // make ourselves the session leader
        if (posix_setsid() == -1) {
            throw new \RuntimeException('Failed to become a daemon.');
        }

        return true;
    }
224050
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;
	}
794312
protected function reapAllChildren(): bool {
        static $killing = false;
        if (!$killing) {
            $this->log(LogLevel::DEBUG, "[{pid}] Shutting down fleet operations...");
            $killing = true;
            foreach ($this->children as $childpid => $childtype) {
                posix_kill($childpid, SIGKILL);
            }

            // Re-send missed signals
            pcntl_signal_dispatch();

            // Wait for children to exit
            while ($this->getFleetSize()) {
                do {
                    $status = null;
                    $pid = pcntl_wait($status, WNOHANG);
                    if ($pid > 0) {
                        $this->reapChild($pid, $status);
                    }
                } while ($pid > 0);
                usleep(10000);
            }
            return true;
        }
        return false;
    }
1133528
public function process()
    {
        if (!$this->_processed) {
            $this->_process();
            $this->_resolve();
        }
        $this->_processed = true;
        return $this->_passed !== false;
    }
709134
public function execute()
    {
        // If the jobset is finished or failed
        // the jobset may need to be dispatched
        // so we return true
        if ($this->isFinished() || $this->isFailed()) {
            return true;
        }
        // Just return false to tell to terminate the process
        if (!$this->isInTime()) {
            return false;
        }
        // return false means the jobset is done
        // and the process should be terminated
        if ($this->isDispatched() || $this->isCanceled()) {
            return false;
        }

        try {
            if (!$this->jobs) {
                $this->initJobs();
            }

            $this->doUnorderedJobs();
            $this->doOrderedJobs();

            $status = $this->getJobsetExecutionStatus();
            if ($status === JobsConst::JOB_SET_STATUS_FAILED) {
                $this->failed();
            } else {
                $this->updateStatus($status);
            }
        } catch (\Exception $e) {
            // just throw it
            throw $e;
        }

        return true;
    }
650445
public function process()
    {
        $value = $this->value();
        if (!is_scalar($value)) {
            return false;
        }

        if (is_string($value)) {
            $value = strtolower($value);
        }

        $bool = null;
        if (in_array($value, $this->getConfig('truthy'), true)) {
            $bool = true;
        } elseif (in_array($value, $this->getConfig('falsy'), true)) {
            $bool = false;
        }

        if ($bool !== null) {
            if (!$this->manager()->getRepository() instanceof Table) {
                foreach ($this->fields() as $field) {
                    $this->getQuery()->where([
                        $field => $bool,
                    ]);
                }

                return true;
            }

            $conditions = [];
            foreach ($this->fields() as $field) {
                $conditions[] = [$field => $bool];
            }

            $this->getQuery()->andWhere([$this->getConfig('mode') => $conditions]);
        }

        return false;
    }
805292
public function getProcess()
    {
        $parentClass = get_parent_class($this);
        $this_prefix = \Closure::bind(function(ProcessBuilder $builder){return $builder->prefix;}, null, $parentClass);
        $this_prefix = $this_prefix($this);
        $this_arguments = \Closure::bind(function(ProcessBuilder $builder){return $builder->arguments;}, null, $parentClass);
        $this_arguments = $this_arguments($this);
        $this_options = \Closure::bind(function(ProcessBuilder $builder){return $builder->options;}, null, $parentClass);
        $this_options = $this_options($this);
        $this_inheritEnv = \Closure::bind(function(ProcessBuilder $builder){return $builder->inheritEnv;}, null, $parentClass);
        $this_inheritEnv = $this_inheritEnv($this);
        $this_env = \Closure::bind(function(ProcessBuilder $builder){return $builder->env;}, null, $parentClass);
        $this_env = $this_env($this);
        $this_cwd = \Closure::bind(function(ProcessBuilder $builder){return $builder->cwd;}, null, $parentClass);
        $this_cwd = $this_cwd($this);
        $this_input = \Closure::bind(function(ProcessBuilder $builder){return $builder->input;}, null, $parentClass);
        $this_input = $this_input($this);
        $this_timeout = \Closure::bind(function(ProcessBuilder $builder){return $builder->timeout;}, null, $parentClass);
        $this_timeout = $this_timeout($this);
        $this_outputDisabled = \Closure::bind(function(ProcessBuilder $builder){return $builder->outputDisabled;}, null, $parentClass);
        $this_outputDisabled = $this_outputDisabled($this);

        if (0 === count($this_prefix) && 0 === count($this_arguments)) {
            throw new LogicException('You must add() command arguments before calling getProcess().');
        }

        $options = $this_options;

        $arguments = array_merge($this_prefix, $this_arguments);
        $script = implode(' ', array_map(array('Symfony\\Component\\Process\\ProcessUtils', 'escapeArgument'), $arguments));

        if ($this_inheritEnv) {
            // include $_ENV for BC purposes
            $env = array_replace($_ENV, $_SERVER, $this_env);
        } else {
            $env = $this_env;
        }

        $process = new Process($script, $this_cwd, $env, $this_input, $this_timeout, $options);

        if ($this_outputDisabled) {
            $process->disableOutput();
        }

        return $process;
    }
555460
public function start()
    {
        $command = $this->buildCommand();
        $process = Process::fromStringCommand($command);

        $this->setProcess($process);
        $this->getProcess()->start(
            function ($type, $content): void {
                $this->wholeOutput[] = $content;
            }
        );

        if ($this->preventOverlapping) {
            $this->lock();
        }

        /** @var int $pid */
        $pid = $this->getProcess()
            ->getPid();

        return $pid;
    }
422874
public function getProcess(): Process
    {
        if ($this->process === null) {
            $this->process = new Process(
                $this->getSchemaName(),
                $this->getInitialState(),
                $this->buildStates()
            );
        }

        return $this->process;
    }
865026
public function execute()
    {
        $buildPath = $this->phpci->buildPath;

        // Check if there are any actions to be run for the branch we're running on:
        if (!array_key_exists($this->build->getBranch(), $this->actions)) {
            return true;
        }

        // If there are, run them:
        $curdir = getcwd();
        chdir($buildPath);

        $success = true;
        foreach ($this->actions[$this->build->getBranch()] as $action => $options) {
            if (!$this->runAction($action, $options)) {
                $success = false;
                break;
            }
        }

        chdir($curdir);

        return $success;
    }
1084771
public function join()
    {
        while (true) {
            $finished = true;
            foreach ($this->processes as $pid => $process) {
                if ($process->isAlive()) {
                    $finished = false;
                    break;
                }
            }

            if ($finished) {
                break;
            }

            unset($finished);
            usleep(10000);
        }
    }
112533
function processChildren()
    {
        if ( !is_array( $this->FunctionChildren ) )
        {
            return false;
        }
        foreach ( array_keys( $this->FunctionChildren ) as $childKey )
        {
            $child = $this->FunctionChildren[$childKey];

            if ( $child[0] == eZTemplate::NODE_FUNCTION ) // check child type
            {
                $childFunctionName = $child[2];

                if ( $childFunctionName == 'break' )
                    return true;
                elseif ( $childFunctionName == 'continue' )
                {
                    $this->SkipSequenceIncrement = true;
                    break;
                }
                elseif ( $childFunctionName == 'skip' )
                {
                    $this->SkipSequenceIncrement = true;
                    $this->SkipDelimiter = true;
                    break;
                }
                elseif ( $childFunctionName == 'delimiter' )
                {
                    if ( $this->Delimiter === null )
                        $this->Delimiter = $child;
                    continue;
                }
            }

            $rslt = $this->Tpl->processNode( $child, $this->TextElements, $this->RootNamespace, $this->CurrentNamespace );

            // break/continue/skip might be found in a child function's (usually {if}) children
            if ( is_array( $rslt ) )
            {
                if ( array_key_exists( 'breakFunctionFound', $rslt ) )
                    return true;
                elseif ( array_key_exists( 'continueFunctionFound', $rslt ) )
                {
                    $this->SkipSequenceIncrement = true;
                    break;
                }
                elseif ( array_key_exists( 'skipFunctionFound', $rslt ) )
                {
                    $this->SkipSequenceIncrement = true;
                    $this->SkipDelimiter = true;
                    break;
                }
            }

        } // foreach

        return false;
    }
719037
public function processes()
    {
        if (is_null($this->processRequests)) {
            $this->processRequests = new ProcessRequests($this->client);
        }

        return $this->processRequests;
    }
686338
public function getAllProcesses()
    {
        $processes = $this->getAllProcessInfo();

        foreach ($processes as $key => $processInfo) {
            $processes[$key] = new Process($processInfo);
        }

        return $processes;
    }
1076139
protected function processLogicalAndNode()
    {
        if (null !== $this->scope->getCurrentLeftNode()
            && null !== $this->scope->getNode()
            && null !== $this->scope->getCurrentOperator()
        ) {
            $node = new BooleanNode($this->scope->getCurrentLeftNode(), $this->scope->getNode(), $this->scope->getCurrentOperator());
            $this->scope
                ->setNode($node)
                ->deleteCurrentLeftNode()
                ->deleteCurrentOperator();
        }

        return $this;
    }
813973
public function start(AbstractProcess $process, string $name = ''): bool
    {
        if ($process->start()) {
            $name = empty($name) ? $process->getName() : $name;
            if (empty($name)) {
                throw new RuntimeException('The process name is not empty');
            }
            $this->processes->put($name, ['pid' => $process->getPid()]);
            $this->processStoreToFile();

            return true;
        }

        return false;
    }
460951
protected function daemonize()
	{
		// Is there already an active daemon running?
		if ($this->isActive())
		{
			$this->getLogger()->emergency($this->name . ' daemon is still running. Exiting the application.');

			return false;
		}

		// Reset Process Information
		$this->safeMode = !!@ ini_get('safe_mode');
		$this->processId = 0;
		$this->running = false;

		// Detach process!
		try
		{
			// Check if we should run in the foreground.
			if (!$this->input->get('f'))
			{
				// Detach from the terminal.
				$this->detach();
			}
			else
			{
				// Setup running values.
				$this->exiting = false;
				$this->running = true;

				// Set the process id.
				$this->processId = (int) posix_getpid();
				$this->parentId = $this->processId;
			}
		}
		catch (\RuntimeException $e)
		{
			$this->getLogger()->emergency('Unable to fork.');

			return false;
		}

		// Verify the process id is valid.
		if ($this->processId < 1)
		{
			$this->getLogger()->emergency('The process id is invalid; the fork failed.');

			return false;
		}

		// Clear the umask.
		@ umask(0);

		// Write out the process id file for concurrency management.
		if (!$this->writeProcessIdFile())
		{
			$this->getLogger()->emergency('Unable to write the pid file at: ' . $this->config->get('application_pid_file'));

			return false;
		}

		// Attempt to change the identity of user running the process.
		if (!$this->changeIdentity())
		{
			// If the identity change was required then we need to return false.
			if ($this->config->get('application_require_identity'))
			{
				$this->getLogger()->critical('Unable to change process owner.');

				return false;
			}
			else
			{
				$this->getLogger()->warning('Unable to change process owner.');
			}
		}

		// Setup the signal handlers for the daemon.
		if (!$this->setupSignalHandlers())
		{
			return false;
		}

		// Change the current working directory to the application working directory.
		@ chdir($this->config->get('application_directory'));

		return true;
	}