src/Zicht/Tool/Container/Executor.php
public function execute($cmd, &$captureOutput = null)
    {
        $isInteractive = $this->container->get('INTERACTIVE');
        $process = $this->createProcess($isInteractive);

        if ($isInteractive) {
            $process->setCommandLine(sprintf('/bin/bash -c \'%s\'', $cmd));
        } else {
            $process->setInput($cmd);
        }

        if (null !== $captureOutput && false === $isInteractive) {
            $process->run(function ($type, $data) use(&$captureOutput) {
                $captureOutput .= $data;
            });
        } else {
            $process->run(array($this, 'processCallback'));
        }

        $ret = $process->getExitCode();

        if ($ret != 0) {
            if ((int)$ret == Container::ABORT_EXIT_CODE) {
                throw new ExecutionAbortedException("Command '$cmd' was aborted");
            } else {
                throw new \UnexpectedValueException("Command '$cmd' failed with exit code {$ret}");
            }
        }
        return $ret;
    }
public function execute($cmd, &$captureOutput = null)
    {
        $isInteractive = $this->container->get('INTERACTIVE');
        $process = $this->createProcess($isInteractive);

        if ($isInteractive) {
            $process->setCommandLine(sprintf('/bin/bash -c \'%s\'', $cmd));
        } else {
            $process->setInput($cmd);
        }

        if (null !== $captureOutput && false === $isInteractive) {
            $process->run(function ($type, $data) use(&$captureOutput) {
                $captureOutput .= $data;
            });
        } else {
            $process->run(array($this, 'processCallback'));
        }

        $ret = $process->getExitCode();

        if ($ret != 0) {
            if ((int)$ret == Container::ABORT_EXIT_CODE) {
                throw new ExecutionAbortedException("Command '$cmd' was aborted");
            } else {
                throw new \UnexpectedValueException("Command '$cmd' failed with exit code {$ret}");
            }
        }
        return $ret;
    }
public function execute ( $ cmd , & $ captureOutput = null ) { $ isInteractive = $ this -> container -> get ( 'INTERACTIVE' ) ; $ process = $ this -> createProcess ( $ isInteractive ) ; if ( $ isInteractive ) { $ process -> setCommandLine ( sprintf ( '/bin/bash -c \'%s\'' , $ cmd ) ) ; } else { $ process -> setInput ( $ cmd ) ; } if ( null !== $ captureOutput && false === $ isInteractive ) { $ process -> run ( function ( $ type , $ data ) use ( & $ captureOutput ) { $ captureOutput .= $ data ; } ) ; } else { $ process -> run ( array ( $ this , 'processCallback' ) ) ; } $ ret = $ process -> getExitCode ( ) ; if ( $ ret != 0 ) { if ( ( int ) $ ret == Container :: ABORT_EXIT_CODE ) { throw new ExecutionAbortedException ( "Command '$cmd' was aborted" ) ; } else { throw new \ UnexpectedValueException ( "Command '$cmd' failed with exit code {$ret}" ) ; } } return $ ret ; }
Executes the passed command line in the shell.

@param string $cmd
@param null &$captureOutput
@param string $captureOutput
@return int

@throws ExecutionAbortedException
@throws \UnexpectedValueException
Executes the passed command line in the shell .