public function execute($cmd, $failOnError = true)
    {
        $command = $this->createSupervisorControlCommand($cmd);
        $this->logger->debug('Executing: ' . $command);
        $p = new Process($command);
        $p->setWorkingDirectory($this->applicationDirectory);
        $p->run();
        if ($failOnError) {
            if ($p->getExitCode() !== 0) {
                $this->logger->critical(sprintf('supervisorctl returns code: %s', $p->getExitCodeText()));
            }
            $this->logger->debug('supervisorctl output: '. $p->getOutput());

            if ($p->getExitCode() !== 0) {
                throw new ProcessException($p);
            }
        }

        return $p;
    }
public function execute($cmd, $failOnError = true)
    {
        $command = $this->createSupervisorControlCommand($cmd);
        $this->logger->debug('Executing: ' . $command);
        $p = new Process($command);
        $p->setWorkingDirectory($this->applicationDirectory);
        $p->run();
        if ($failOnError) {
            if ($p->getExitCode() !== 0) {
                $this->logger->critical(sprintf('supervisorctl returns code: %s', $p->getExitCodeText()));
            }
            $this->logger->debug('supervisorctl output: '. $p->getOutput());

            if ($p->getExitCode() !== 0) {
                throw new ProcessException($p);
            }
        }

        return $p;
    }
public function execute ( $ cmd , $ failOnError = true ) { $ command = $ this -> createSupervisorControlCommand ( $ cmd ) ; $ this -> logger -> debug ( 'Executing: ' . $ command ) ; $ p = new Process ( $ command ) ; $ p -> setWorkingDirectory ( $ this -> applicationDirectory ) ; $ p -> run ( ) ; if ( $ failOnError ) { if ( $ p -> getExitCode ( ) !== 0 ) { $ this -> logger -> critical ( sprintf ( 'supervisorctl returns code: %s' , $ p -> getExitCodeText ( ) ) ) ; } $ this -> logger -> debug ( 'supervisorctl output: ' . $ p -> getOutput ( ) ) ; if ( $ p -> getExitCode ( ) !== 0 ) { throw new ProcessException ( $ p ) ; } } return $ p ; }
Execute a supervisorctl command

@param $cmd string supervisorctl command
@param $failOnError bool indicate id errors should raise an exception
@return \Symfony\Component\Process\Process
Execute a supervisorctl command