private function startProcess(OutputInterface $output)
    {
        $arguments = $this->resolveProcessArgs();
        $name = sha1(serialize($arguments));
        if ($this->background->hasProcess($name)) {
            throw new \RuntimeException("Service is already running.");
        }

        $builder = new ProcessBuilder($arguments);

        if ($this->hasParameter('cwd')) {
            $builder->setWorkingDirectory($this->getParameter('cwd'));
        }

        $process = $builder->getProcess();

        if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) {
            $output->writeln($process->getCommandLine());
        }

        if ($this->hasParameter('output')) {
            $append = $this->hasParameter('append') && $this->getParameter('append') ? 'a' : 'w';
            $stream = fopen($this->getParameter('output'), $append);
            $output = new StreamOutput($stream, StreamOutput::VERBOSITY_NORMAL, true);
        }

        $process->start(
            function ($type, $buffer) use ($output) {
                $output->write($buffer);
            }
        );

        $this->background->addProcess($name, $process);

        if (!in_array($process->getExitCode(), $this->getParameter('successCodes'))) {
            throw new TaskRuntimeException($this->getName(), $process->getErrorOutput());
        }
    }
private function startProcess(OutputInterface $output)
    {
        $arguments = $this->resolveProcessArgs();
        $name = sha1(serialize($arguments));
        if ($this->background->hasProcess($name)) {
            throw new \RuntimeException("Service is already running.");
        }

        $builder = new ProcessBuilder($arguments);

        if ($this->hasParameter('cwd')) {
            $builder->setWorkingDirectory($this->getParameter('cwd'));
        }

        $process = $builder->getProcess();

        if ($output->getVerbosity() === OutputInterface::VERBOSITY_VERBOSE) {
            $output->writeln($process->getCommandLine());
        }

        if ($this->hasParameter('output')) {
            $append = $this->hasParameter('append') && $this->getParameter('append') ? 'a' : 'w';
            $stream = fopen($this->getParameter('output'), $append);
            $output = new StreamOutput($stream, StreamOutput::VERBOSITY_NORMAL, true);
        }

        $process->start(
            function ($type, $buffer) use ($output) {
                $output->write($buffer);
            }
        );

        $this->background->addProcess($name, $process);

        if (!in_array($process->getExitCode(), $this->getParameter('successCodes'))) {
            throw new TaskRuntimeException($this->getName(), $process->getErrorOutput());
        }
    }
private function startProcess ( OutputInterface $ output ) { $ arguments = $ this -> resolveProcessArgs ( ) ; $ name = sha1 ( serialize ( $ arguments ) ) ; if ( $ this -> background -> hasProcess ( $ name ) ) { throw new \ RuntimeException ( "Service is already running." ) ; } $ builder = new ProcessBuilder ( $ arguments ) ; if ( $ this -> hasParameter ( 'cwd' ) ) { $ builder -> setWorkingDirectory ( $ this -> getParameter ( 'cwd' ) ) ; } $ process = $ builder -> getProcess ( ) ; if ( $ output -> getVerbosity ( ) === OutputInterface :: VERBOSITY_VERBOSE ) { $ output -> writeln ( $ process -> getCommandLine ( ) ) ; } if ( $ this -> hasParameter ( 'output' ) ) { $ append = $ this -> hasParameter ( 'append' ) && $ this -> getParameter ( 'append' ) ? 'a' : 'w' ; $ stream = fopen ( $ this -> getParameter ( 'output' ) , $ append ) ; $ output = new StreamOutput ( $ stream , StreamOutput :: VERBOSITY_NORMAL , true ) ; } $ process -> start ( function ( $ type , $ buffer ) use ( $ output ) { $ output -> write ( $ buffer ) ; } ) ; $ this -> background -> addProcess ( $ name , $ process ) ; if ( ! in_array ( $ process -> getExitCode ( ) , $ this -> getParameter ( 'successCodes' ) ) ) { throw new TaskRuntimeException ( $ this -> getName ( ) , $ process -> getErrorOutput ( ) ) ; } }
Creates the given process

@throws \Exception
Creates the given process