src/Synapse/CliCommand/AbstractCliCommand.php
public function run(CliCommandOptions $options = null)
    {
        $options   = $this->getOptions($options);
        $command   = $this->buildCommand($options);
        $startTime = microtime(true);

        $response = $this->executor->execute(
            $command,
            $options->getCwd(),
            $options->getEnv()
        );

        $elapsedTime = microtime(true) - $startTime;
        $output      = $response->getOutput();
        $returnCode  = $response->getReturnCode();

        return new CliCommandResponse([
            'command'      => $command,
            'elapsed_time' => $elapsedTime,
            'output'       => $output,
            'start_time'   => $startTime,
            'return_code'  => $returnCode,
            'successful'   => $returnCode === 0,
        ]);
    }
public function run(CliCommandOptions $options = null)
    {
        $options   = $this->getOptions($options);
        $command   = $this->buildCommand($options);
        $startTime = microtime(true);

        $response = $this->executor->execute(
            $command,
            $options->getCwd(),
            $options->getEnv()
        );

        $elapsedTime = microtime(true) - $startTime;
        $output      = $response->getOutput();
        $returnCode  = $response->getReturnCode();

        return new CliCommandResponse([
            'command'      => $command,
            'elapsed_time' => $elapsedTime,
            'output'       => $output,
            'start_time'   => $startTime,
            'return_code'  => $returnCode,
            'successful'   => $returnCode === 0,
        ]);
    }
public function run ( CliCommandOptions $ options = null ) { $ options = $ this -> getOptions ( $ options ) ; $ command = $ this -> buildCommand ( $ options ) ; $ startTime = microtime ( true ) ; $ response = $ this -> executor -> execute ( $ command , $ options -> getCwd ( ) , $ options -> getEnv ( ) ) ; $ elapsedTime = microtime ( true ) - $ startTime ; $ output = $ response -> getOutput ( ) ; $ returnCode = $ response -> getReturnCode ( ) ; return new CliCommandResponse ( [ 'command' => $ command , 'elapsed_time' => $ elapsedTime , 'output' => $ output , 'start_time' => $ startTime , 'return_code' => $ returnCode , 'successful' => $ returnCode === 0 , ] ) ; }
Executes a cli command

@param  CliCommandOptions $options object of `cwd`, `env`, and `redirect`
@return CliCommandResponse object with output and comand information
Executes a cli command