Handle a command execution

@param Command $command
@return mixed
184130
public function handle(Command $command)
    {
        $handler = $this->container->make($this->handlerName);

        return $handler->handle($command);
    }
800868
public function get($command)
    {
        $commands = $this->getHandlers();
        return empty($commands[$command]) ? array() : $commands[$command];
    }
1330399
public function handle($command)
    {
        $message = $this->message->send($command->conversation, $command->body, $command->senderId, $command->type);

        $this->dispatcher->dispatch($this->message->releaseEvents());

        return $message;
    }
49604
private function execute(Command $command)
    {
        $exec = $this->exec;
        $exec->setCommand($command);
        $code = $exec->run();
        $output = $exec->getOutput();

        if ($exec->hasErrors()) {

            switch ($code) {
                case 127:
                    $msg = 'git command not found, make sure it is installed an in the system path';
                    break;
                default:
                    $msg = 'Git execution failed : ' .$code . ' ' . $output['stderror'];
                    break;
            }

            throw new \RuntimeException($msg, $code);
        }

        return $code;
    }
1330302
public function handle(AbstractCommand $command)
    {
        $this->commandDispatcher->handle($command);
        // Now that the command is handled, let's found if there is some events to publish
        $events = $this->extractEventsFromCommand($command);
        foreach ($events as $event) {
            // we will only publish event to synchronous listeners
            $this->publish($event);
        }

        return $command;
    }
693655
protected function handleCustomIni($command)
    {
        // If --ini parameter was not specified, just return the command
        // is at has been constructed.
        if (!$this->option('ini')) {
            return $command;
        }

        // Additional parameter will not work when escaped with single quotes.
        $command = str_replace("'", '', $command);

        // Determine the path
        $iniPath = ($this->option('ini-path') === $this->defaultIniPath)
          ? $this->laravel->basePath() . '/' . $this->defaultIniPath
          : $this->option('ini-path');

        $iniPath = realpath($iniPath);

        $this->info('Loading custom configuration file: ' . $iniPath, 'v');

        if (!file_exists($iniPath)) {
            $this->warn(sprintf(
              'File %s does not exist. Custom configuration will not be loaded.',
              $iniPath
            ));
        }

        // Append PHP parameter with a path to the configuration file.
        $command .= ' -c ' . $iniPath;

        return $command;
    }
13970
public function exec( $command ) {
		$command .= ' 2>&1';
		$command = escapeshellcmd( $command );
		exec( $command, $output, $return_var );

		return [ $output, $return_var ];
	}
1349103
public function execute($command)
    {
        exec($command, $result, $returnValue);

        if ($returnValue === 0) {
            return $result;
        }

        throw new \RuntimeException(sprintf('Failed to execute command: %s', $command), $returnValue);
    }
1351478
public function handle($command)
    {
        $this->commandStack[] = $command;

        if ($this->executing) {
            return;
        }

        $first = true;

        while ($command = array_shift($this->commandStack)) {
            $this->invokeHandler($command, $first);
            $first = false;
        }
    }
712411
public function handle(PlainCommand $command)
    {
        $awsCommand = $this->transformToAwsCommand($command);

        /** @var \GuzzleHttp\Promise\PromiseInterface $promise */
        $promise = $this->s3Client->executeAsync($awsCommand);

        return $this->commandIsAsync($command) ? $promise : $promise->wait();
    }
428694
public function handle($command)
    {
        if (!is_object($command)) {
            throw InvalidCommandException::forUnknownValue($command);
        }

        $middlewareChain = $this->middlewareChain;
        return $middlewareChain($command);
    }
750570
public function dispatch(Command $command)
    {
        // If beforeCommand fails abort
        if ($this->_eventsManager->fire('command:beforeCommand', $command) === false) {
            return false;
        }

        // If run the commands fails abort too
        if ($command->run($command->getParameters()) === false) {
            return false;
        }

        $this->_eventsManager->fire('command:afterCommand', $command);

        return true;
    }
570915
public function handle($command)
    {
        $comment = $this->writeComment->by($command->userId)->withText($command->body)->about($command->ticketId)->get();
        $this->commentRepository->save($comment);

        $this->dispatchEventsFor($this->writeComment);

        return $comment;
    }
269784
public function execute(CommandInterface $command)
    {
        $commandHandler = $this->handlerRepository->getHandler($command);

        if ($commandHandler instanceof CommandExecutorAwareInterface) {
            $commandHandler->setCommandExecutor($this);
        }

        try {
            $result = $commandHandler->handle($command);

            if (!($result instanceof CommandResultInterface)) {
                if (false === $result) {
                    $result = CommandResult::error();
                } else {
                    $result = CommandResult::success();
                }
            }
        } catch (\Exception $e) {
            if ($this->debug) {
                throw $e;
            }

            $result = CommandResult::error(null, [], $e);
        }

        $this->processMessages($command, $result);

        return $result;
    }
618732
public function execute(interfaces\commands\Command $command)
    {
        $handler = $this->resolver->resolve($command);
        
        return call_user_func([$handler, 'handle'], $command);
    }
698289
protected function dispatch(Command $command)
    {
        // re-connect if we have timed out
        if ($this->isTimedOut() === true) {
            $this->close();
            $this->connect();
        }

        // construct message
        $message = $command->getCommand() . "\r\n";

        if (($data = $command->getData()) !== false) {
            $message .= $data . "\r\n";
        }

        // write to stream
        if ($this->stream->write($message) === false) {
            throw new Exception(
                'Error writing data to the server.',
                Exception::SERVER_WRITE
            );
        }

        // read response from stream
        $response = $this->stream->readLine();

        // validate against common errors
        $this->validateResponse($response);

        $data = null;

        if ($command->returnsData()) {
            $bytes = preg_replace('/^.*\b(\d+)$/', '$1', $response);
            $data = $this->stream->read($bytes);
        }

        return $command->parseResponse($response, $data, $this);
    }
328385
private function executeCommand($command)
    {
        $descriptors = [
            0 => ['pipe', 'r'], // STDIN
            1 => ['pipe', 'w'], // STDOUT
            2 => ['pipe', 'w']  // STDERR
        ];

        $process = proc_open($command . ' 2>&1', $descriptors, $pipes);
        if (!is_resource($process)) {
            return 'Can not execute command.';
        }

        // Nothing to push to STDIN
        fclose($pipes[0]);

        $output = stream_get_contents($pipes[1]);
        fclose($pipes[1]);

        $error = stream_get_contents($pipes[2]);
        fclose($pipes[2]);

        // All pipes must be closed before 'proc_close'
        $code = proc_close($process);

        if (!empty($error)) {
            $output .= ', exit wit error:' . $error . ', code: ' . $code;
        }
        return $output;
    }