protected function startFork($pid, $callback, Task $task, Process $oldProcess = null)
    {
        if ($pid === -1) {
            $this->cliHelper->writeTimeLine('Could not fork!');
            exit;
        } elseif ($pid) {
            $newProcess = new Process($task, $pid);
            $this->processes[$pid] = $newProcess;
        
            if ($callback !== null) {
                if ($oldProcess !== null) {
                    call_user_func($callback, $oldProcess, $newProcess);
                } else {
                    call_user_func($callback, $newProcess);
                }
            }
        } else {
            $this->executeTask($task);
        }
    }