Executes the given command and returns the output.

@param  $lbcommand
@param  string $lbparams the command to execute
@throws BuildException
@return string the output of the executed command
16726
protected function execute($lbcommand, $lbparams = '')
    {
        $nestedparams = "";
        foreach ($this->parameters as $p) {
            $nestedparams .= $p->getCommandline($this->project) . ' ';
        }
        $nestedprops = "";
        foreach ($this->properties as $p) {
            $nestedprops .= $p->getCommandline($this->project) . ' ';
        }

        $command = sprintf(
            'java -jar %s --changeLogFile=%s --url=%s --username=%s --password=%s --classpath=%s %s %s %s %s 2>&1',
            escapeshellarg($this->jar),
            escapeshellarg($this->changeLogFile),
            escapeshellarg($this->url),
            escapeshellarg($this->username),
            escapeshellarg($this->password),
            escapeshellarg($this->classpathref),
            $nestedparams,
            escapeshellarg($lbcommand),
            $lbparams,
            $nestedprops
        );

        if ($this->passthru) {
            passthru($command);
        } else {
            $output = [];
            $return = null;
            exec($command, $output, $return);
            $output = implode(PHP_EOL, $output);

            if ($this->display) {
                print $output;
            }

            if (!empty($this->outputProperty)) {
                $this->project->setProperty($this->outputProperty, $output);
            }

            if ($this->checkreturn && $return != 0) {
                throw new BuildException("Liquibase exited with code $return");
            }
        }

        return;
    }
915316
public function main()
    {
        $failCount = 0;
        $taskNo = 0;
        if (count($this->taskList) === 0) {
            throw new BuildException('No tasks specified for <relentless>.');
        }
        $this->log('Relentlessly executing: ' . $this->getDescription());
        foreach ($this->taskList as $t) {
            $taskNo++;
            $desc = $t->getDescription();
            if ($desc === null) {
                $desc = 'task ' . $taskNo;
            }
            if (!$this->terse) {
                $this->log('Executing: ' . $desc);
            }
            try {
                $t->perform();
            } catch (BuildException $x) {
                $this->log('Task ' . $desc . ' failed: ' . $x->getMessage());
                $failCount++;
            }
        }
        if ($failCount > 0) {
            throw new BuildException(
                'Relentless execution: ' . $failCount . ' of ' . count($this->taskList) . ' tasks failed.'
            );
        }

        $this->log('All tasks completed successfully.');
    }
779040
private function checkParams()
    {
        if ($this->file === null && empty($this->filesets) && empty($this->dirsets)) {
            throw new BuildException(
                "Specify at least one source - a file, dirset or a fileset."
            );
        }

        if ($this->mode === null) {
            throw new BuildException("You have to specify an octal mode for chmod.");
        }

        // check for mode to be in the correct format
        if (!preg_match('/^([0-7]){3,4}$/', $this->mode)) {
            throw new BuildException("You have specified an invalid mode.");
        }
    }
1113051
private function executeCommand(string $command, array $parameters = []): self
    {
        if (! $this->progressBar->getProgress()) {
            $this->progressBar->start();
        }

        $result = $this->call($command, $parameters);
        if ($result) {
            $parameters = http_build_query($parameters, '', ' ');
            $parameters = str_replace('%5C', '/', $parameters);
            $this->alert("An error has occurred. The '{$command} {$parameters}' command was not executed");
        }

        $this->progressBar->advance();

        // Visually slow down the installation process so that the user can read what's happening
        usleep(350000);

        return $this;
    }
1114019
private function createFromCommand()
    {
        $command = MainCommand::getInstance($this->repository)->status(true);
        $lines = $this->repository->getCaller()->execute($command)->getOutputLines(true);
        $this->parseOutputLines($lines);
    }
934413
public function execute($command, $params = null)
    {
        $url = $command;

        if (substr($url, -1) !== '/') {
            $url .= '/';
        }

        if ($params) {
            $parameters = array();
            foreach ($params as $k => $v) {
                if (strlen($v)) {
                    $parameters[] = urlencode($k) . '=' . urlencode($v);
                } else {
                    $parameters[] = urlencode($k);
                }
            }
            $url .= '?' . implode('&', $parameters);
        }

        try {
            $response = $this->client->get($url);
        } catch (\Exception $e) {
            return null;
        }
        $this->checkError($response, $url);

        return $response->getBody();
    }
367356
public function main()
    {
        if ($this->function === null && $this->expression === null) {
            throw new BuildException(
                "You must specify a function to execute or PHP expression to evalute.",
                $this->getLocation()
            );
        }

        if ($this->function !== null && $this->expression !== null) {
            throw new BuildException("You can specify function or expression, but not both.", $this->getLocation());
        }

        if ($this->expression !== null && !empty($this->params)) {
            throw new BuildException(
                "You cannot use nested <param> tags when evaluationg a PHP expression.",
                $this->getLocation()
            );
        }

        if ($this->function !== null) {
            $this->callFunction();
        } elseif ($this->expression !== null) {
            $this->evalExpression();
        }
    }
584392
public function executeCommand(Command $command)
    {
        if ($command instanceof DsnDependent) {
            $command->setDsn($this->dsn);
        }

        $shellCmd = self::VTCTLD_EXECUTABLE . ' ' . $this->getServerString() . ' '
             . $command->getName() . ' ' . implode(' ', $command->getParams());

        exec($shellCmd, $output, $return);
        $output = implode("\n", $output);

        if ($return !== 0) {
            throw new Exception('Error running vtctld command - ' . $shellCmd . ', error: ' . $output);
        }

        $resultClass = $command->getResultClass();

        return new $resultClass($this->dsn, $output);
    }
1058912
public function command($command, array $parameters = array())
    {
        $binary = ProcessUtils::escapeArgument((new PhpExecutableFinder)->find(false));

        if (defined('HHVM_VERSION')) {
            $binary .= ' --php';
        }

        if (defined('FORGE_BINARY')) {
            $forge = ProcessUtils::escapeArgument(FORGE_BINARY);
        } else {
            $forge = 'forge';
        }

        return $this->exec("{$binary} {$forge} {$command}", $parameters);
    }
1201988
public function executeCommand(array $arguments, $processBuilderCallback = null)
    {
        $processBuilder = clone $this->processBuilder;
        $processBuilder->setArguments($arguments);

        if (is_callable($processBuilderCallback)) {
            $processBuilderCallback($processBuilder);
        }

        $process = $processBuilder->getProcess();
        $process->run();

        if (!$process->isSuccessful()) {
            if (127 === $process->getExitCode()) {
                throw new ExecutableNotFoundException($process);
            }

            throw new ProcessFailedException($process);
        }

        return $process;
    }
1101084
public function main()
    {
        if (null === $this->getRepository()) {
            throw new BuildException('"repository" is required parameter');
        }
        if (null === $this->getBranchname()) {
            throw new BuildException('"branchname" is required parameter');
        }

        // if we are moving branch, we need to know new name
        if ($this->isMove() || $this->isForceMove()) {
            if (null === $this->getNewBranch()) {
                throw new BuildException('"newbranch" is required parameter');
            }
        }

        $client = $this->getGitClient(false, $this->getRepository());

        $command = $client->getCommand('branch');

        if (version_compare($client->getGitVersion(), '2.15.0', '<')) {
            $command->setOption('set-upstream', $this->isSetUpstream());
        } elseif ($this->isSetUpstreamTo()) {
            $command->setOption('set-upstream-to', $this->getSetUpstreamTo());
        }

        $command
            ->setOption('no-track', $this->isNoTrack())
            ->setOption('force', $this->isForce());
        if ($this->isNoTrack() == false) {
            $command->setOption('track', $this->getTrack());
        }

        // check extra options (delete, move)
        foreach ($this->extraOptions as $option => $flag) {
            if ($flag) {
                $command->setOption($option, true);
            }
        }

        $command->addArgument($this->getBranchname());

        if (null !== $this->getStartPoint()) {
            $command->addArgument($this->getStartPoint());
        }

        if (null !== $this->getNewBranch()) {
            $command->addArgument($this->getNewBranch());
        }

        $this->log('git-branch command: ' . $command->createCommandString(), Project::MSG_INFO);

        try {
            $output = $command->execute();
        } catch (Exception $e) {
            throw new BuildException(
                'Task execution failed with git command "' . $command->createCommandString() . '""',
                $e
            );
        }

        $this->log(
            sprintf('git-branch: branch "%s" repository', $this->getRepository()),
            Project::MSG_INFO
        );
        $this->log('git-branch output: ' . str_replace('\'', '', trim($output)), Project::MSG_INFO);
    }
125778
def _exec_command(adb_cmd):
    
    t = tempfile.TemporaryFile()
    final_adb_cmd = []
    for e in adb_cmd:
        if e != '':  # avoid items with empty string...
            final_adb_cmd.append(e)  # ... so that final command doesn't
            # contain extra spaces
    print('\n*** Executing ' + ' '.join(adb_cmd) + ' ' + 'command')

    try:
        output = check_output(final_adb_cmd, stderr=t)
    except CalledProcessError as e:
        t.seek(0)
        result = e.returncode, t.read()
    else:
        result = 0, output
        print('\n' + result[1])

    return result
628982
protected function runCommand(\Parable\Console\Command $command, array $parameters = [])
    {
        $parameter = new \Parable\Console\Parameter();
        $parameter->setParameters($parameters);

        $command->prepare($this->app, $this->output, $this->input, $parameter);

        return $command->run();
    }
1011927
public function call($command, array $parameters = [], $outputBuffer = null)
    {
        $this->bootstrap();

        return $this->getConsole()->call($command, $parameters, $outputBuffer);
    }
1361829
public function main()
    {
        if (!$this->defaultrequested && $this->add === "" && $this->remove === "" && !$this->echo) {
            throw new BuildException(
                "<defaultexcludes> task must set at least one attribute (echo=\"false\")"
                . " doesn't count since that is the default"
            );
        }
        if ($this->defaultrequested) {
            DirectoryScanner::resetDefaultExcludes();
        }
        if ($this->add !== "") {
            DirectoryScanner::addDefaultExclude($this->add);
        }
        if ($this->remove !== "") {
            DirectoryScanner::removeDefaultExclude($this->remove);
        }
        if ($this->echo) {
            $lineSep = Phing::getProperty('line.separator');
            $message = "Current Default Excludes:";
            $message .= $lineSep;
            $excludes = DirectoryScanner::getDefaultExcludes();
            $message .= "  ";
            $message .= implode($lineSep . "  ", $excludes);
            $this->log($message, $this->logLevel);
        }
    }
122796
private function _execute_command() {
		$app = new Application( 'Codeception', \Codeception\Codecept::VERSION );
		$app->add( new \WPCC\Command\Build( 'build' ) );
		$app->add( new \Codeception\Command\Console( 'console' ) );
		$app->add( new \WPCC\Command\Bootstrap( 'bootstrap' ) );
		$app->add( new \Codeception\Command\GenerateCept( 'generate-cept' ) );
		$app->add( new \Codeception\Command\GenerateCest( 'generate-cest' ) );
		$app->add( new \Codeception\Command\GenerateTest( 'generate-test' ) );
		$app->add( new \Codeception\Command\GeneratePhpUnit( 'generate-phpunit' ) );
		$app->add( new \Codeception\Command\GenerateSuite( 'generate-suite' ) );
		$app->add( new \Codeception\Command\GenerateHelper( 'generate-helper' ) );
		$app->add( new \Codeception\Command\GenerateScenarios( 'generate-scenarios' ) );
		$app->add( new \Codeception\Command\Clean( 'clean' ) );
		$app->add( new \Codeception\Command\GenerateGroup( 'generate-group' ) );
		$app->add( new \Codeception\Command\GeneratePageObject( 'generate-pageobject' ) );
		$app->add( new \Codeception\Command\GenerateStepObject( 'generate-stepobject' ) );
		$app->run( new ArgvInput() );
	}
184355
public function command($command, array $parameters = [])
    {
        if (class_exists($command)) {
            $command = (new $command)->getName();
        }

        return $this->exec(
            Application::formatCommandString($command), $parameters
        );
    }