Run an console command by name.

@param string $command
@param array  $parameters

@return int
545551
public function call($command, array $parameters = [])
    {
        array_unshift($parameters, $command);

        $this->lastOutput = new BufferedOutput;

        $this->setCatchExceptions(false);

        $result = $this->run(new ArrayInput($parameters), $this->lastOutput);

        $this->setCatchExceptions(true);

        return $result;
    }
572958
protected function runOtherCommand($name, array $arguments = array())
	{
		$arguments['command'] = $name;
		$cleanup_command = $this->getApplication()->find($name);

		$input = new ArrayInput($arguments);

		return $cleanup_command->run($input, $this->io->getOutput());
	}
20736
public function call( $command, array $parameters = [] )
	{
		$parameters = collect( $parameters )->prepend( $command );

		$this->lastOutput = new BufferedOutput;

		$this->setCatchExceptions( false );

		$result = $this->run( new ArrayInput( $parameters->toArray() ), $this->lastOutput );

		$this->setCatchExceptions( true );

		return $result;
	}
1186842
public function execute($commandName, $params = [])
    {
        $className = str_replace(' ', '', ucwords(str_replace('-', ' ', $commandName))) . 'Command';
        $clearCommandName = $this->getNamespace() . "\\console\\" . $className;
        if (!class_exists($clearCommandName)) $clearCommandName = '\\app\\console\\' . $className;
        if (!class_exists($clearCommandName)) $clearCommandName = 'PhpDevil\\framework\\console\\commands\\' . $className;
        if (!class_exists($clearCommandName)) die("\nCommand " . $commandName . " not found");
        (new $clearCommandName)->execute($params);
    }
835781
public function Run($functionName, $parameters)
	{
		if(!array_key_exists($functionName, $this->functions))
			return "\nError: The command '{$functionName}' does not exist\n";

		$response = $this->functions[$functionName]($parameters);
		
		return "\n{$response}\n";
	}
1202689
private function performRequest($command, $parameters)
        {
        // add the apikey to the parameters
        $parameters["key"] = $this->api_key;

        // make an array out of the dictionary so that each element is a key value pair glued together with an '=', and urlencode the parameters
        $param_array = array();
        foreach ($parameters as $key=>$value)
            $param_array[] = "$key=" . urlencode($value);

        // glue the array together unto a string with elements connected with '&'
        $params = implode("&", $param_array);

        // put the whole URL together now
        $url = $this->base_url . $command . "?" . $params;

        // cal the server
        $json = $this->call($url);

        $data = json_decode($json, true);

        if (isset($data["error"]))
          {
          $this->error["code"]    = $data["error"]["code"];
          $this->error["message"] = $data["error"]["message"];
          $data = false;
          }

        return $data;
        }
376431
public function execute(string $query, array $parameters = []): int
    {
        return $this->statement($query, $parameters)->rowCount();
    }
590093
public function call($command, array $parameters = array())
	{
		$this->bootstrap();

		// If we are calling a arbitary command from within the application, we will load
		// all of the available deferred providers which will make all of the commands
		// available to an application. Otherwise the command will not be available.
		$this->app->loadDeferredProviders();

		return $this->getArtisan()->call($command, $parameters);
	}
1208433
protected function executeShellCommand($command, array $options = [])
    {
        $return = 0;
        passthru('DEV_QUIET=true '.$this->replaceVars($command, $this->getConfig()), $return);

        if (0 !== $return) {
            throw new \RuntimeException(
                (isset($options['v']) && true === $options['v'])
                    ? sprintf("Execution failed for [%s]", $command)
                    : "Execution failed",
                ($return > 0 && 256 > $return) ? $return : 255
            );
        }

        return $this;
    }
1298598
public function runSingleCommand($command)
    {
        $cmd = 'php ' . $this->directory . 'app/console ';

        return $this->phpci->executeCommand($cmd . $command, $this->directory);
    }
39388
protected function triggerCommand($command, $arguments = null)
    {
        return $this->getCommandBus()->execute($command, $arguments ?: $this->arguments, $this->update);
    }
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;
    }
318589
private function exec($command, $params = []) {
        if (in_array($command, $this->available_commands)) {
            // convert json to array then get the last messages info
            $output = json_decode($this->curl_get_contents($this->api . '/' . $command, $params), true);

            return $this->convertToObject($output);
        } else {
            echo 'command not found';
        }
    }
1011927
public function call($command, array $parameters = [], $outputBuffer = null)
    {
        $this->bootstrap();

        return $this->getConsole()->call($command, $parameters, $outputBuffer);
    }
1073509
public function run(string $command) : int
    {
        $output = [];
        $returnVar = 1;

        $command .= $this->isWindows() ? $this->STD_ERR_PIPE_WIN : $this->STD_ERR_PIPE;

        exec($command, $output, $returnVar);

        return $returnVar;
    }
611624
public function run(string $command) : Process {
        $mutedCommand = Str::startsWith($command, 'artisan')
            ? str_replace('artisan ', '', $command)
            : $command;

        ignore_user_abort();

        $logName    = explode(' -', $mutedCommand, 2)[0];
        $log        = storage_path('logs' . DIRECTORY_SEPARATOR . snake_case(Str::slug($logName)) . '.log');
        $rootPath   = base_path();

        shell_exec("cd $rootPath && php artisan $mutedCommand >> " . $log . " &");

        exec('pgrep php', $processIds);
        exec('ps ahxwwo pid:1,command:1 | grep php | grep -v grep | grep -v emacs', $processes);

        $this->check();

        return $this->getProcessByCommand($command);
    }
465431
public function doRun(InputInterface $input, OutputInterface $output)
    {
        if (true === $input->hasParameterOption(['--version', '-V'], true)) {
            $output->writeln($this->getLongVersion());

            return 0;
        }

        try {
            // Makes ArgvInput::getFirstArgument() able to distinguish an option from an argument.
            $input->bind($this->getDefinition());
        } catch (ExceptionInterface $e) {
            // Errors must be ignored, full binding/validation happens later when the command is known.
        }

        $name = $this->getCommandName($input);
        if (true === $input->hasParameterOption(['--help', '-h'], true)) {
            if (!$name) {
                $name = 'help';
                $input = new ArrayInput(['command_name' => $this->defaultCommand]);
            } else {
                $this->wantHelps = true;
            }
        }

        if (!$name) {
            $name = $this->defaultCommand;
            $definition = $this->getDefinition();
            $definition->setArguments(array_merge(
                $definition->getArguments(),
                [
                    'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
                ]
            ));
        }

        try {
            $this->runningCommand = null;
            // the command name MUST be the first element of the input
            $command = $this->find($name);
        } catch (\Throwable $e) {
            if (!($e instanceof CommandNotFoundException && !$e instanceof NamespaceNotFoundException) || 1 !== \count($alternatives = $e->getAlternatives()) || !$input->isInteractive()) {
                if (null !== $this->dispatcher) {
                    $event = new ConsoleErrorEvent($input, $output, $e);
                    $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);

                    if (0 === $event->getExitCode()) {
                        return 0;
                    }

                    $e = $event->getError();
                }

                throw $e;
            }

            $alternative = $alternatives[0];

            $style = new SymfonyStyle($input, $output);
            $style->block(sprintf("\nCommand \"%s\" is not defined.\n", $name), null, 'error');
            if (!$style->confirm(sprintf('Do you want to run "%s" instead? ', $alternative), false)) {
                if (null !== $this->dispatcher) {
                    $event = new ConsoleErrorEvent($input, $output, $e);
                    $this->dispatcher->dispatch($event, ConsoleEvents::ERROR);

                    return $event->getExitCode();
                }

                return 1;
            }

            $command = $this->find($alternative);
        }

        $this->runningCommand = $command;
        $exitCode = $this->doRunCommand($command, $input, $output);
        $this->runningCommand = null;

        return $exitCode;
    }