Commander::execute
339130
public function execute()
    {
        parent::execute();

        if (empty($this->optionFilename)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_FILENAME'))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        }

        if (strpos($this->optionPath, 'Commanders') === false) {
            $filePath = $this->optionPath . 'Commanders' . DIRECTORY_SEPARATOR . $this->optionFilename;
        } else {
            $filePath = $this->optionPath . $this->optionFilename;
        }

        $fileDirectory = dirname($filePath) . DIRECTORY_SEPARATOR;

        if ( ! is_dir($fileDirectory)) {
            mkdir($fileDirectory, 0777, true);
        }

        if (is_file($filePath)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::DANGER)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_E_EXISTS', [$filePath]))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_ERROR);
        }

        $className = prepare_class_name(pathinfo($filePath, PATHINFO_FILENAME));
        @list($namespaceDirectory, $subNamespace) = explode('Commanders', dirname($filePath));

        $classNamespace = loader()->getDirNamespace(
                $namespaceDirectory
            ) . 'Commanders' . (empty($subNamespace)
                ? null
                : str_replace(
                    '/',
                    '\\',
                    $subNamespace
                )) . '\\';

        $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m');
        $vars[ 'NAMESPACE' ] = trim($classNamespace, '\\');
        $vars[ 'PACKAGE' ] = '\\' . trim($classNamespace, '\\');
        $vars[ 'CLASS' ] = $className;
        $vars[ 'FILEPATH' ] = $filePath;

        $phpTemplate = <<<PHPTEMPLATE
<?php
/**
 * Created by O2System Framework File Generator.
 * DateTime: CREATE_DATETIME
 */

// ------------------------------------------------------------------------

namespace NAMESPACE;

// ------------------------------------------------------------------------

use O2System\Framework\Http\Commander;

/**
 * Class CLASS
 *
 * @package PACKAGE
 */
class CLASS extends Commander
{
    /**
     * CLASS::index
     */
    public function index()
    {
        // TODO: Change the autogenerated stub
    }
}
PHPTEMPLATE;

        $fileContent = str_replace(array_keys($vars), array_values($vars), $phpTemplate);
        file_put_contents($filePath, $fileContent);

        if (is_file($filePath)) {
            output()->write(
                (new Format())
                    ->setContextualClass(Format::SUCCESS)
                    ->setString(language()->getLine('CLI_MAKE_COMMANDER_S_MAKE', [$filePath]))
                    ->setNewLinesAfter(1)
            );

            exit(EXIT_SUCCESS);
        }
    }
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;
        }
    }
448690
def _execute_command(command)
      begin
        unless self.is_active?
          raise WampRails::Error.new("WAMP Rails Client #{self.name} is currently not active.")
        end

        command.execute
      rescue Exception => e
        puts e.to_s if self.verbose
        command.callback(nil, {error: 'wamp_rails.error', args: [e.to_s], kwargs: nil}, nil)
      end
    end
747062
function execute($command) {
        $output = array();
        $result = null;

        // Redirect standard error to stdout so we can do something with
        // it.
        $command .= " 2>&1";

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

        if ($result !== 0) {
            if ($result === self::RESULT_CODE_COMMAND_NOT_FOUND) {
                throw new CommandNotFoundError(implode("\t", $output), $result);
            }
            else {
                throw new ExecutionError(implode("\t", $output), $result);
            }
        }
        return $output;
    }
3091
def execute_command(self, *args, **options):
        """"""
        pool = self.connection_pool
        command_name = args[0]
        for i in _xrange(self.execution_attempts):
            connection = pool.get_connection(command_name, **options)
            try:
                connection.send_command(*args)
                res = self.parse_response(connection, command_name, **options)
                pool.release(connection)
                return res
            except ConnectionError:
                pool.purge(connection)
                if i >= self.execution_attempts - 1:
                    raise
1260031
public function handle()
    {
        parent::handle();

        $modelGenerator = new ModelGenerator($this->commandData);
        $modelGenerator->generate();

        $this->performPostActions();
    }
414214
def execute(command, params={})
      unless params[:dry_run]
        if params[:return]
          System.execute(command, :return => true)
        else
          $stdout.puts
          System.execute(command)
        end
      end
    end
1019389
async def execute_command(self, command):
        """"""
        self.apply_future = asyncio.Future(loop=self.loop)

        entry = self.log.write(self.storage.term, command)
        asyncio.ensure_future(self.append_entries(), loop=self.loop)

        await self.apply_future
1323158
def execute_command(self, *args, **kwargs):
        """"""
        try:
            return self.get_connection().execute_command(*args, **kwargs)
        except ConnectionError as e:
            logger.warn('trying to reconnect')
            self.connect()
            logger.warn('connected')
            raise
712580
def execute_command(self, *args, **options):
        
        pool = self.connection_pool
        command_name = args[0]
        connection = pool.get_connection(command_name, **options)
        try:
            connection.send_command(*args)
            return self.parse_response(connection, command_name, **options)
        except ConnectionError:
            connection.disconnect()
            connection.send_command(*args)
            return self.parse_response(connection, command_name, **options)
        finally:
            pool.release(connection)
757338
def do_commander(self):
        """"""
        # Flatten commands list then extract primary command and its arguments.
        if self._args.commands is not None:
            cmds = []
            for cmd in self._args.commands:
                cmds.append(flatten_args(split_command_line(arg) for arg in cmd))
        else:
            cmds = None

        # Enter REPL.
        PyOCDCommander(self._args, cmds).run()
10180
public function execute()
	{
		if ($this->output->isInteractive())
		{
			$actions = array('add', 'delete', 'install', 'enable', 'disable');
			$action  = $this->output->getResponse('What do you want to do? ['.implode("|", $actions).']');

			if (in_array($action, $actions))
			{
				$this->$action();
			}
			else
			{
				$this->output->error('Sorry, I don\'t know how to do that.');
			}
		}
		else
		{
			$this->output = $this->output->getHelpOutput();
			$this->help();
			$this->output->render();
			return;
		}
	}
646558
protected function executeCommand()
    {
        static $methods = [
            'HEAD',
            'GET',
            'POST',
            'PUT',
            'DELETE'
        ];

        \Akamai\Open\EdgeGrid\Client::setDebug(true);
        \Akamai\Open\EdgeGrid\Client::setVerbose(true);

        $args = $this->climate->arguments->all();
        $client = new Client();

        if ($this->climate->arguments->defined('auth-type')) {
            $auth = $this->climate->arguments->get('auth');
            if ($this->climate->arguments->get('auth-type') === 'edgegrid' ||
                (!$this->climate->arguments->defined('auth-type'))) {
                $section = 'default';
                if ($this->climate->arguments->defined('auth')) {
                    $section = (substr($auth, -1) === ':') ? substr($auth, 0, -1) : $auth;
                }
                $client = Client::createFromEdgeRcFile($section);
            }

            if (in_array($this->climate->arguments->get('auth-type'), ['basic', 'digest'])) {
                if (!$this->climate->arguments->defined('auth') || $this->climate->arguments->get('auth') === null) {
                    $this->help();
                    return;
                }

                $auth = [
                    $auth,
                    null,
                    $this->climate->arguments->get('auth-type')
                ];

                if (strpos(':', $auth[0]) !== false) {
                    list($auth[0], $auth[1]) = explode(':', $auth[0]);
                }

                $client = new Client(['auth' => $auth]);
            }
        }

        $method = 'GET';
        $options = [];
        $body = [];

        foreach ($args as $arg) {
            $value = $arg->value();
            if (empty($value) || is_bool($value) || $arg->longPrefix()) {
                continue;
            }

            if (in_array(strtoupper($value), $methods)) {
                $method = $arg->value();
                continue;
            }

            if (!isset($url) && preg_match('@^(http(s?)://|:).*$@', trim($value))) {
                $url = $value;

                if ($url{0} === ':') {
                    $url = substr($url, 1);
                }

                continue;
            }

            $matches = [];
            if (preg_match('/^(?<key>.*?):=(?<file>@?)(?<value>.*?)$/', $value, $matches)) {
                if (!$value = $this->getArgValue($matches)) {
                    return false;
                }

                $body[$matches['key']] = json_decode($value);
                continue;
            }

            if (preg_match('/^(?<header>.*?):(?<value>.*?)$/', $value, $matches)
                && !preg_match('@^http(s?)://@', $value)) {
                $options['headers'][$matches['header']] = $matches['value'];
                continue;
            }

            if (preg_match('/^(?<key>.*?)=(?<file>@?)(?<value>.*?)$/', $value, $matches)) {
                if (!$value = $this->getArgValue($matches)) {
                    return false;
                }

                $body[$matches['key']] = $matches['value'];
                continue;
            }

            if (!isset($url)) {
                $url = $value;
                continue;
            }

            $this->help();
            $this->climate->error('Unknown argument: ' . $value);

            return false;
        }

        $stdin = '';
        $fp = fopen('php://stdin', 'rb');
        if ($fp) {
            stream_set_blocking($fp, false);
            $stdin = fgets($fp);
            if (!empty(trim($stdin))) {
                while (!feof($fp)) {
                    $stdin .= fgets($fp);
                }
                fclose($fp);
            }
            $stdin = rtrim($stdin);
        }

        if (!empty($stdin) && !empty($body)) {
            $this->help();
            $this->climate->error(
                'error: Request body (from stdin or a file) and request data (key=value) cannot be mixed.'
            );
            return;
        }

        if (!empty($stdin)) {
            $body = $stdin;
        }

        if (count($body) && !$this->climate->arguments->defined('form')) {
            if (!isset($options['headers']['Content-Type'])) {
                $options['headers']['Content-Type'] = 'application/json';
            }
            if (!isset($options['headers']['Accept'])) {
                $options['headers']['Accept'] = 'application/json';
            }
            $options['body'] = (!is_string($body)) ? json_encode($body) : $body;
        }

        if (count($body) && $this->climate->arguments->defined('form')) {
            if (!isset($options['headers']['Content-Type'])) {
                $options['headers']['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8';
            }

            $options['body'] = (!is_string($body)) ? http_build_query($body, null, null, PHP_QUERY_RFC1738) : $body;
        }

        $options['allow_redirects'] = false;
        if ($this->climate->arguments->defined('follow')) {
            $options['allow_redirects'] = true;
        }

        return $client->request($method, $url, $options);
    }
86903
protected function cmdExecute() /*: void*/
    {
        /**
         * @see simplecomplex_utils_cli()
         */
        $container = Dependency::container();

        $utils = Utils::getInstance();

        // Validate input. ---------------------------------------------
        $path = $file = $path_file = '';
        if (empty($this->command->arguments['include-file'])) {
            $this->command->inputErrors[] = !isset($this->command->arguments['include-file']) ?
                'Missing \'include-file\' argument.' : 'Empty \'include-file\' argument.';
        } else {
            $include_file = $this->command->arguments['include-file'];
            $path = dirname($include_file);
            $file = basename($include_file);
            try {
                $path = $utils->resolvePath($path);
                $path_file = $path . '/' . $file;
                if (!file_exists($path_file) || !is_file($path_file)) {
                    $this->command->inputErrors[] = 'Arg include-file resolved to[' . $path_file . ']'
                        . (!file_exists($path_file) ? ' doesn\'t exist' : ' is not a file') . '.';
                }
            } catch (\Throwable $xcptn) {
                $this->command->inputErrors[] = 'Arg include-file[' . $include_file . '] is not a valid path+filename.'
                    . "\n" . $container->get('inspect')->variable($xcptn)->toString(false);
            }
        }
        $force = !empty($this->command->options['force']);
        // Pre-confirmation --yes/-y ignored for this command,
        // unless combined with --force/-f.
        // And 'silent' is neither allowed.
        if ($this->command->preConfirmed && !$force) {
            $this->command->inputErrors[] = 'Pre-confirmation \'yes\'/-y option not supported for this command,'
                . ' unless combined with \'force\'/-f option.';
        }
        if ($this->command->inputErrors) {
            foreach ($this->command->inputErrors as $msg) {
                $this->environment->echoMessage(
                    $this->environment->format($msg, 'hangingIndent'),
                    'notice'
                );
            }
            // This command's help text.
            $this->environment->echoMessage("\n" . $this->command);
            exit;
        }
        // Display command and the arg values used.---------------------
        if (!$this->command->preConfirmed || !$force) {
            $this->environment->echoMessage(
                $this->environment->format(
                    $this->environment->format($this->command->name, 'emphasize')
                    . "\n" . 'include-file (resolved): '
                    . $utils->pathReplaceDocumentRoot($path) . '/' . $this->environment->format($file, 'emphasize'),
                    'hangingIndent'
                )
            );
        }
        // Request confirmation, ignore --yes/-y pre-confirmation option;
        // ignore .risky_command_skip_confirm file placed in document root
        // ...unless combined with --force/-f option.
        if (
            (!$this->command->preConfirmed || !$force)
            && !$this->environment->confirm(
                '(RISKY) Execute that include script? Type \'yes\' to continue:',
                ['yes'],
                '',
                'Aborted executing include script.'
            )
        ) {
            exit;
        }
        // Check if the command is doable.------------------------------
        // Nothing to check here.
        try {
            // Prevent scope bleed.
            (function($pathFile) {
                include($pathFile);
            })($path_file);
            // Apparant success, at least no exception thrown.
            $this->environment->echoMessage(
                'Executed include script '
                . $utils->pathReplaceDocumentRoot($path) . '/' . $this->environment->format($file, 'emphasize'),
                'notice'
            );
        } catch (\Throwable $xcptn) {
            $this->environment->echoMessage(
                'Executing include script ' . $path . '/' . $this->environment->format($file, 'emphasize')
                . "\n" . ' produced error.',
                'warning'
            );
            /**
             * Pass on to
             * @see Bootstrap::setExceptionHandler()
             */
            throw $xcptn;
        }
        exit;
    }
1371876
function execute(id) {
        var command = _commands[id];

        if (command) {
            try {
                exports.trigger("beforeExecuteCommand", id);
            } catch (err) {
                console.error(err);
            }

            return command.execute.apply(command, Array.prototype.slice.call(arguments, 1));
        } else {
            return (new $.Deferred()).reject().promise();
        }
    }
1040036
def executeCommand(self, command):
        
        self._sendAction("Command", (
            ("Command", command),
        ))
        resp = self._getResponse()
        result = resp.get("Response")
        if result == "Follows":
            return resp.get("command_response")
        elif result == "Error":
            raise Exception("Execution of Asterisk Manager Interface Command "
                            "(%s) failed with error message: %s" % 
                            (command, str(resp.get("Message"))))
        else:
            raise Exception("Execution of Asterisk Manager Interface Command "
                            "failed: %s" % command)
112620
def execute_command(self, command):
        

        self.runner.info_log("Executing command: %s" % command)

        process = Popen(
                command,
                stdout=open(os.devnull, 'w'),
                stderr=open('runner.log', 'a'),
        )

        return process