runs the command and returns an exit code

@return  int
768273
public function run(): int
    {
        $className = $this->console->writeLine('Stubbles ConsoleAppCreator')
                ->writeLine(' (c) 2012-2016 Stubbles Development Group')
                ->writeEmptyLine()
                ->prompt('Please enter the full qualified class name for the console app: ')
                ->withFilter(ClassNameFilter::instance());
        if (null === $className) {
            $this->console->writeLine('The entered class name is not a valid class name');
            return -10;
        }

        $this->classFile->create($className);
        $this->scriptFile->create($className);
        $this->testFile->create($className);
        return 0;
    }
1297533
public function run()
    {
        foreach ($this->getCommands() as $command)
        {
            $this->transformer->transform($command);

            $this->application->add($command);
        }

        return $this->application->run();
    }
1007018
protected function doRun()
    {
        $result = 0;
        $args = func_get_args();
        $host = $this->session->getHost();

        if (count($args) === 3) {
            list($method, $params, $retval) = $args;

            // Strip namespace 
            $method = trim(str_replace(__NAMESPACE__, '', $method),'\\');
            $command = $method.' => ['.implode(' , ', $params).']';
            $this->printOut('<comment>' . $host . '</comment> < <info>' . $command.'</info>');

            // Initial result evaluation
            $result = $retval;
            $halt = $result == false;

            // Prints process information
            // @codeCoverageIgnoreStart
            if ($halt) {
                $this->printOut('<error>Aborted</error>');
            } else {
                if (is_string($retval) || is_array($retval)) {

                    if(is_array($retval)) {
                        foreach ($retval as $key => $val) {
                            if ( ! is_numeric($key)) $resultDioArray[] = $key.':'.$val;
                        }
                    } else {
                        $resultDioArray = array_filter(explode("\n", $retval));
                    }


                    foreach ($resultDioArray as $i => $resultDioLine) {
                        $this->printOut((($i === 0) ? '<comment>'.$host.'</comment>' : str_pad(' ', strlen($host))).' > <info>'.$resultDioLine.'</info>');
                    }
                } else {
                    $this->printOut('<comment>'.$host.'</comment> > <info>[OK]</info>');
                }
            }
            // @codeCoverageIgnoreEnd
        }

        return $result;
    }
1158657
public function start(): int
    {
        $scripts = $this->installManager->install();

        $this->processRunner = new ProcessRunner($scripts->getStubService(), $this->getArguments());

        $processId =  $this->processRunner->run();
        \sleep(1); // wait for server to start

        return $processId;
    }
70387
public function run_check_stderr() {
		$r = $this->run();

		if ( $r->return_code || ! empty( $r->stderr ) ) {
			throw new \RuntimeException( $r );
		}

		return $r;
	}
224135
protected function run()
	{
		fputs( STDOUT, ":> " );
		while( $line = $this->readLine() )
		{
			$line = preg_replace( "/\n*|\r*/", "", $line );
			$line = preg_replace( "/;$/", "", $line );
			if( strlen( $line ) )
			{
				if( $this->isImmediate( $line ) )
					$line = "return( ".$line." )";
				ob_start();
				$ret = eval( "unset(\$line); $line;" );
				if( ob_get_length() == 0)
				{
					if( is_bool( $ret ) )
						echo( $ret ? "true" : "false" );
					else if( is_string( $ret ) )
						echo "'" . addcslashes( $ret, "\0..\37\177..\377" )  . "'";
					else if( !is_null( $ret ) )
						print_r( $ret );
				}
				unset($ret);
				$out = ob_get_contents();
				ob_end_clean();
				if( ( strlen( $out ) > 0) && ( substr( $out, -1 ) != "\n" ) )
					$out .= "\n";
				fputs( STDOUT, "=> ".$out );
				unset( $out );
				fputs( STDOUT, ":> " );
			}
		}
	}
892896
public function run()
    {
        if (! $this->runPreSearch()) {
            return $this->value;
        }

        if ((strlen($this->value) % 4 == 0) and preg_match('/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/isU', $this->value)) {
            $decoded = base64_decode($this->value, true);
            if (base64_encode($decoded) === $this->value) {
                return $decoded;
            }
        }

        return $this->value;
    }
428570
public function run()
    {
        $command = new \ReflectionClass($this);
        $options = input()->get();

        if (empty($options)) {
            if ($this->welcomeNote instanceof Format or $this->welcomeNote instanceof Text) {
                output()->write($this->welcomeNote);
            } elseif (is_string($this->welcomeNote) and $this->welcomeNote !== '') {
                output()->write(
                    (new Format())
                        ->setString(language()->getLine($this->welcomeNote))
                        ->setNewLinesAfter(1)
                );
            }

            output()->write(
                (new Format())
                    ->setString($this->name . ' v' . $this->version)
                    ->setNewLinesBefore(2)
                    ->setNewLinesAfter(1)
            );

            // Run help option
            $this->optionHelp();
        } else {

            foreach ($options as $method => $arguments) {

                if ($method === 'h') {
                    $method = 'help';
                } elseif ($method === 'v') {
                    $method = 'version';
                } elseif ($method === 'vv') {
                    $method = 'verbose';
                }

                $optionMethod = camelcase('option-' . $method);

                if ($command->hasMethod($optionMethod)) {

                    $commandMethod = $command->getMethod($optionMethod);

                    if ($commandMethod->getNumberOfRequiredParameters() == 0) {
                        call_user_func([&$this, $optionMethod]);
                    } else {
                        $optionArguments = is_array($arguments)
                            ? $arguments
                            : [$arguments];

                        call_user_func_array([&$this, $optionMethod], $optionArguments);
                    }
                }
            }
        }
    }
792976
public function execute()
    {
        list($ignore) = $this->getFlags();

        $phplint = $this->phpci->findBinary('parallel-lint');

        $cmd = $phplint . ' -e %s' . '%s %s "%s"';
        $success = $this->phpci->executeCommand(
            $cmd,
            $this->extensions,
            ($this->shortTag ? ' -s' : ''),
            $ignore,
            $this->directory
        );

        $output = $this->phpci->getLastOutput();

        $matches = array();
        if (preg_match_all('/Parse error\:/', $output, $matches)) {
            $this->build->storeMeta('phplint-errors', count($matches[0]));
        }

        return $success;
    }
959192
public function execute()
    {
        $ignore = '';
        if (count($this->ignore)) {
            $namesExclude = ' --names-exclude ';
            foreach ($this->ignore as $item) {
                // remove the trailing slash
                $item = rtrim($item, DIRECTORY_SEPARATOR);

                if (is_file(rtrim($this->path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $item)) {
                    $ignoredFile = explode('/', $item);
                    $filesToIgnore[] = array_pop($ignoredFile);
                } else {
                    $ignore .= ' --exclude ' . $item;
                }
            }

            if (isset($filesToIgnore)) {
                $filesToIgnore = $namesExclude . implode(',', $filesToIgnore);
                $ignore = $ignore . $filesToIgnore;
            }
        }

        $phpcpd = $this->phpci->findBinary('phpcpd');

        $tmpfilename = tempnam('/tmp', 'phpcpd');

        $cmd = $phpcpd . ' --log-pmd "%s" %s "%s"';
        $success = $this->phpci->executeCommand($cmd, $tmpfilename, $ignore, $this->path);

        print $this->phpci->getLastOutput();

        $errorCount = $this->processReport(file_get_contents($tmpfilename));
        $this->build->storeMeta('phpcpd-warnings', $errorCount);

        unlink($tmpfilename);

        return $success;
    }
416019
public function sniffCode() {
    $task = $this->taskExecStack()
      ->dir($this->bltRoot)
      ->exec("{$this->bin}/phpcs")
      ->exec("composer validate");
    $result = $task->run();

    return $result->getExitCode();
  }
774781
public function counterCommand(): int
    {
        $total = 120;
        $ctt   = Show::counterTxt('handling ...', 'handled.');
        $this->write('Counter:');

        while ($total - 1) {
            $ctt->send(1);
            usleep(30000);
            $total--;
        }

        // end of the counter.
        $ctt->send(-1);

        // $this->output->aList($data, 'runtime profile');

        return 0;
    }
1295646
public function cmdDeleteCountry()
    {
        $code = $this->getParam(0);
        $all = $this->getParam('all');

        if (empty($code) && empty($all)) {
            $this->errorAndExit($this->text('Invalid command'));
        }

        $result = null;

        if (!empty($code)) {
            $result = $this->country->delete($code);
        } else if (!empty($all)) {

            $deleted = $count = 0;
            foreach ($this->country->getList() as $item) {
                $count++;
                $deleted += (int) $this->country->delete($item['code']);
            }

            $result = $count && $count == $deleted;
        }

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        $this->output();
    }
514842
public function execute()
	{
		if (count($this->children) && count($this->input->args))
		{
			$name = $this->input->args[0];

			try
			{
				return $this->executeSubCommand($name);
			}
			catch (CommandNotFoundException $e)
			{
				$e->getCommand()->renderAlternatives($e->getChild(), $e);

				return $e->getCode();
			}
			catch (\Exception $e)
			{
				$this->renderException($e);

				return $e->getCode();
			}
		}

		if ($this->handler)
		{
			if ($this->handler instanceof \Closure)
			{
				$code = $this->handler;

				return $code($this);
			}
			elseif (is_callable($this->handler))
			{
				return call_user_func($this->handler, $this);
			}
		}

		return $this->doExecute();
	}
215317
public function run()
    {
        $defaultCommand = null;
        $command        = null;

        if ($this->defaultCommand) {
            $defaultCommand = $this->getCommand($this->defaultCommand);
        }
        if (!$this->shouldOnlyUseDefaultCommand()) {
            $commandName = $this->parameter->getCommandName();
            if ($commandName) {
                $command = $this->getCommand($commandName);
            }
            $this->parameter->enableCommandName();
        } else {
            $this->parameter->disableCommandName();
        }

        // Use $command or $defaultCommand, since they're mutually exclusive
        $command = $command ?: $defaultCommand;

        if (!$command) {
            throw new \Parable\Console\Exception('No valid commands found.');
        }

        $this->activeCommand = $command;

        $this->parameter->setCommandArguments($command->getArguments());
        $this->parameter->checkCommandArguments();

        $this->parameter->setCommandOptions($command->getOptions());
        $this->parameter->checkCommandOptions();

        return $command->run();
    }
613356
public function run()
    {
        $error = $this->error;
        $output = $this->output;

        return $this->builder->getProcess()->run(
            function ($type, $buffer) use ($error, $output) {
                if ('err' === $type) {
                    if ($error) {
                        $error($buffer);
                    }
                } elseif ($output) {
                    $output($buffer);
                }
            }
        );
    }
580770
public function processRequest()
	{
		$exitCode=$this->_runner->run($_SERVER['argv']);
		if(is_int($exitCode))
			$this->end($exitCode);
	}