Executes command.

            { "op" : "c",
              "ns" : "testdb.$cmd",
              "o" : { "drop" : "fs.files"}
            }
551335
def command(self, ns, raw, **kw):
        
        try:
            dbname = raw['ns'].split('.', 1)[0]
            self.dest[dbname].command(raw['o'], check=True)
        except OperationFailure, e:
            logging.warning(e)
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
437095
public static void executeCommand(String[] args) throws Exception {
        String subCmd = (args.length > 0) ? args[0] : "";
        args = AdminToolUtils.copyArrayCutFirst(args);
        if(subCmd.equals("async-job")) {
            AdminCommandAsyncJob.executeCommand(args);
        } else if(subCmd.equals("scheduled")) {
            AdminCommandScheduled.executeCommand(args);
        } else if(subCmd.equals("cleanup")) {
            AdminCommandCleanup.executeCommand(args);
        } else if(subCmd.equals("debug")) {
            AdminCommandDebug.executeCommand(args);
        } else if(subCmd.equals("meta")) {
            AdminCommandMeta.executeCommand(args);
        } else if(subCmd.equals("quota")) {
            AdminCommandQuota.executeCommand(args);
        } else if(subCmd.equals("store")) {
            AdminCommandStore.executeCommand(args);
        } else if(subCmd.equals("stream")) {
            AdminCommandStream.executeCommand(args);
        } else if(subCmd.equals("help") || subCmd.equals("--help") || subCmd.equals("-h")) {
            executeHelp(args, System.out);
        } else {
            args = AdminToolUtils.copyArrayAddFirst(args, subCmd);
            AdminCommandOther.executeCommand(args);
        }
    }
1269659
function Batch(db, options) {
  this.options = options || {};
  this.ops = [];
  this.db = db;
  this.written = false;
}
592064
function exec() {

  var actions = {
    commands: {
      init: { action: _init },
      run : { action: _run }
    }
  };

  cli.command(__dirname, actions);
}
1294682
def cli(ctx, pattern):
    """"""
    matches = utils.grep_commands(pattern)
    if matches:
        selected = utils.select_command(matches)
        if selected >= 0:
            cmd, desc = matches[selected]
            command = "$ {} :: {}".format(cmd, desc)
            if click.confirm("Remove\n\t{}\n\n?".format(command), default=True):
                utils.remove_command(cmd)
                click.echo('Command successfully removed!')
    elif matches == []:
        click.echo('No saved commands matches the pattern {}'.format(pattern))
    else:
        click.echo("No commands to remove, Add one by 'keep new'. ")
1374853
public void execute() {

        checkParameters();

        if (loadCommandOptions.data != null) {

            if (loadCommandOptions.loaderParams.containsKey("mongodb-index-folder")) {
                configuration.getDatabases().getMongodb().getOptions().put("mongodb-index-folder",
                        loadCommandOptions.loaderParams.get("mongodb-index-folder"));
            }
            // If 'authenticationDatabase' is not passed by argument then we read it from configuration.json
            if (loadCommandOptions.loaderParams.containsKey("authenticationDatabase")) {
                configuration.getDatabases().getMongodb().getOptions().put("authenticationDatabase",
                        loadCommandOptions.loaderParams.get("authenticationDatabase"));
            }

//                loadRunner = new LoadRunner(loader, database, loadCommandOptions.loaderParams, numThreads, configuration);
            loadRunner = new LoadRunner(loader, database, numThreads, configuration);

            String[] loadOptions;
            if (loadCommandOptions.data.equals("all")) {
                loadOptions = new String[]{EtlCommons.GENOME_DATA, EtlCommons.GENE_DATA, EtlCommons.CONSERVATION_DATA,
                        EtlCommons.REGULATION_DATA, EtlCommons.PROTEIN_DATA, EtlCommons.PPI_DATA,
                        EtlCommons.PROTEIN_FUNCTIONAL_PREDICTION_DATA, EtlCommons.VARIATION_DATA,
                        EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA, EtlCommons.CLINICAL_VARIANTS_DATA,
                        EtlCommons.REPEATS_DATA, EtlCommons.STRUCTURAL_VARIANTS_DATA, };
            } else {
                loadOptions = loadCommandOptions.data.split(",");
            }

            for (int i = 0; i < loadOptions.length; i++) {
                String loadOption = loadOptions[i];
                try {
                    switch (loadOption) {
                        case EtlCommons.GENOME_DATA:
                            loadIfExists(input.resolve("genome_info.json"), "genome_info");
                            loadIfExists(input.resolve("genome_sequence.json.gz"), "genome_sequence");
                            loadIfExists(input.resolve("genomeVersion.json"), METADATA);
                            loadRunner.index("genome_sequence");
                            break;
                        case EtlCommons.GENE_DATA:
                            loadIfExists(input.resolve("gene.json.gz"), "gene");
                            loadIfExists(input.resolve("dgidbVersion.json"), METADATA);
                            loadIfExists(input.resolve("ensemblCoreVersion.json"), METADATA);
                            loadIfExists(input.resolve("uniprotXrefVersion.json"), METADATA);
                            loadIfExists(input.resolve("geneExpressionAtlasVersion.json"), METADATA);
                            loadIfExists(input.resolve("hpoVersion.json"), METADATA);
                            loadIfExists(input.resolve("disgenetVersion.json"), METADATA);
                            loadRunner.index("gene");
                            break;
                        case EtlCommons.VARIATION_DATA:
                            loadVariationData();
                            break;
                        case EtlCommons.VARIATION_FUNCTIONAL_SCORE_DATA:
                            loadIfExists(input.resolve("cadd.json.gz"), "cadd");
                            loadIfExists(input.resolve("caddVersion.json"), METADATA);
                            loadRunner.index("variation_functional_score");
                            break;
                        case EtlCommons.CONSERVATION_DATA:
                            loadConservation();
                            break;
                        case EtlCommons.REGULATION_DATA:
                            loadIfExists(input.resolve("regulatory_region.json.gz"), "regulatory_region");
                            loadIfExists(input.resolve("ensemblRegulationVersion.json"), METADATA);
                            loadIfExists(input.resolve("mirbaseVersion.json"), METADATA);
                            loadIfExists(input.resolve("targetScanVersion.json"), METADATA);
                            loadIfExists(input.resolve("miRTarBaseVersion.json"), METADATA);
                            loadRunner.index("regulatory_region");
                            break;
                        case EtlCommons.PROTEIN_DATA:
                            loadIfExists(input.resolve("protein.json.gz"), "protein");
                            loadIfExists(input.resolve("uniprotVersion.json"), METADATA);
                            loadIfExists(input.resolve("interproVersion.json"), METADATA);
                            loadRunner.index("protein");
                            break;
                        case EtlCommons.PPI_DATA:
                            loadIfExists(input.resolve("protein_protein_interaction.json.gz"), "protein_protein_interaction");
                            loadIfExists(input.resolve("intactVersion.json"), METADATA);
                            loadRunner.index("protein_protein_interaction");
                            break;
                        case EtlCommons.PROTEIN_FUNCTIONAL_PREDICTION_DATA:
                            loadProteinFunctionalPrediction();
                            break;
                        case EtlCommons.CLINICAL_VARIANTS_DATA:
                            loadClinical();
                            break;
                        case EtlCommons.REPEATS_DATA:
                            loadRepeats();
                            break;
                        case EtlCommons.STRUCTURAL_VARIANTS_DATA:
                            loadStructuralVariants();
                            break;
                        default:
                            logger.warn("Not valid 'data'. We should not reach this point");
                            break;
                    }
                } catch (IllegalAccessException | InstantiationException | InvocationTargetException | ExecutionException
                        | NoSuchMethodException | InterruptedException | ClassNotFoundException | LoaderException | IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
1187536
function (cmd, cwd) {
      return execute(cmd, cwd ? path.resolve(target, cwd) : target)
    }
521998
@Override
    public void execute()
            throws MojoExecutionException, MojoFailureException
        {
        boolean fExplicit = this.script != null;
        String  script    = fExplicit
                            ? this.script
                            : execution.getLifecyclePhase();

        String SCRIPT_NOT_FOUND = "Script '" + script + "' is not defined in package.json";

        Package pkg = getPackage();
        if (fExplicit && !pkg.hasScript(script))
            {
            getLog().error(SCRIPT_NOT_FOUND);
            throw new MojoFailureException(SCRIPT_NOT_FOUND);
            }
        else if (pkg.hasScript(script))
            {
            if (!fExplicit && script.endsWith("test") && skipTests)
                {
                getLog().info("Tests are skipped.");
                }
            else
                {
                CommandLine cmdLine = getNpmCommand();
                addCommand(cmdLine);
                cmdLine.addArgument(script);
                addArguments(cmdLine);

                execute(cmdLine);
                }
            }
        else
            {
            getLog().info(SCRIPT_NOT_FOUND);
            }
        }
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
1262846
def _post_execute(self):
        

        if self.todolist.dirty:
            # do not archive when the value of the filename is an empty string
            # (i.e. explicitly left empty in the configuration
            if self.do_archive and config().archive():
                self._archive()
            elif config().archive() and self.backup:
                archive = _retrieve_archive()[0]
                self.backup.add_archive(archive)

            self._post_archive_action()

            if config().keep_sorted():
                from topydo.commands.SortCommand import SortCommand
                self._execute(SortCommand, [])

            if self.backup:
                self.backup.save(self.todolist)

            self.todofile.write(self.todolist.print_todos())
            self.todolist.dirty = False

        self.backup = None
525977
function execute(req, res) {
  // TODO: ensure a conflict is triggered on all watched keys
  req.db.flushdb();
  res.send(null, Constants.OK);
}
934054
def run (cmd, verbosity=0, **kwargs):
    """"""
    # Note that shell_quote_nt() result is not suitable for copy-paste
    # (especially on Unix systems), but it looks nicer than shell_quote().
    if verbosity >= 0:
        log_info("running %s" % " ".join(map(shell_quote_nt, cmd)))
    if kwargs:
        if verbosity >= 0:
            log_info("    with %s" % ", ".join("%s=%s" % (k, shell_quote(str(v)))\
                                           for k, v in kwargs.items()))
        if kwargs.get("shell"):
            # for shell calls the command must be a string
            cmd = " ".join(cmd)
    if verbosity < 1:
        # hide command output on stdout
        with open(os.devnull, 'wb') as devnull:
            kwargs['stdout'] = devnull
            res = subprocess.call(cmd, **kwargs)
    else:
        res = subprocess.call(cmd, **kwargs)
    return res
544092
function runCommand (cmd, args = [], stdio = 'inherit') {
  return new Promise((resolve, reject) => {
    const proc = spawn(cmd, args, { stdio });
    const completeCommand = `${cmd} ${args.join(' ')}`.trim();

    proc.on('error', err => {
      return reject(new CommandFailure(completeCommand));
    });

    proc.on('close', code => {
      code = sanitizeCode(code);
      if (code !== 0) {
        return reject(new CommandFailure(completeCommand, code));
      }
      resolve();
    });
  });
}
503361
function execute(command, callback){
  exec(command, function(error, stdout, stderr){ callback(error, stdout); });
}
777688
public void run(String cmd, CommandFilter f) {

        CommandWords commandWord = null;

        if ( cmd.contains(" ") ) {
            try {
                commandWord = CommandWords.valueOf(cmd.substring(1, cmd.indexOf(" ")));
            } catch (IllegalArgumentException e) {
                commandWord = CommandWords.INVALID_COMMAND_WORD;
            }
        } else {
            commandWord = CommandWords.INVALID_COMMAND_WORD;
        }

        switch (commandWord) {
            case change_player_type:
                f.changePlayerTypeCommand(cmd.substring(20, cmd.length() - 1));
                break;
            case error:
                f.errorCommand(cmd.substring(7, cmd.length() - 1));
                break;
            case hear:
                f.hearCommand(cmd.substring(6, cmd.length() - 1));
                break;
            case init:
                f.initCommand(cmd.substring(6, cmd.length() - 1));
                break;
            case ok:
                f.okCommand(cmd.substring(4, cmd.length() - 1));
                break;
            case player_param:
                f.playerParamCommand(cmd.substring(14, cmd.length() - 1));
                break;
            case player_type:
                f.playerTypeCommand(cmd.substring(13, cmd.length() - 1));
                break;
            case see:
                f.seeCommand(cmd.substring(5, cmd.length() - 1));
                break;
            case see_global:
                f.seeCommand(cmd.substring(12, cmd.length() - 1));
                break;
            case sense_body:
                f.senseBodyCommand(cmd.substring(12, cmd.length() - 1));
                break;
            case server_param:
                f.serverParamCommand(cmd.substring(14, cmd.length() - 1));
                break;
            case warning :
                f.warningCommand(cmd.substring(9, cmd.length() - 1));
                break;
            case INVALID_COMMAND_WORD :
            default :
                throw new Error("Invalid command received: \"" + cmd + "\"");
        }
    }
189234
function execCommand(command, options, callback) {
		var args = [],
			extraArgs = (options.args || []).slice(0),
			preferGlobal = options.preferGlobal || false,
			srcSuccess = options.success,
			srcFailure = options.failure,
			success, failure;

		// remove processed options
		delete options.args;
		delete options.command;
		delete options.failure;
		delete options.preferGlobal;
		delete options.success;

		// must have output to satisfy success/failure conditions
		if (srcSuccess || srcFailure) {
			delete options.quiet;
		}

		// determine succes and failure types
		if (_.isRegExp(srcSuccess)) {
			success = function(data) { return srcSuccess.test(data); };
		} else if (_.isString(srcSuccess)) {
			success = function(data) { return data.toString().indexOf(srcSuccess) !== -1; };
		} else if (_.isFunction(srcSuccess)) {
			success = srcSuccess;
		} else if (!!success) {
			success = undefined;
			grunt.fail.warn('invalid type for success option, must be string, regexp, or function');
		}

		if (_.isRegExp(srcFailure)) {
			failure = function(data) { return srcFailure.test(data); };
		} else if (_.isString(srcFailure)) {
			failure = function(data) { return data.toString().indexOf(srcFailure) !== -1; };
		} else if (_.isFunction(srcFailure)) {
			failure = srcFailure;
		} else if (!!failure) {
			failure = undefined;
			grunt.fail.warn('invalid type for failure option, must be string, regexp, or function');
		}

		// create the list of command arguments
		Object.keys(options).forEach(function(key) {
			var value = options[key],
				isBool = _.isBoolean(value);
			if (!isBool || (isBool && !!value)) {
				args.push(camelCaseToDash(key));
			}
			if (!isBool) { args.push(value); }
		});
		args.unshift(command);

		// add non-option, non-flag arguments
		args = args.concat(extraArgs);

		// spawn command and output
		grunt.log.writeln('titanium ' + args.join(' '));
		var tiOpts = process.env.GRUNT_TITANIUM_TEST || success || failure ?
				{} : {stdio: 'inherit'},
			ti = spawn(getTitaniumPath(preferGlobal), args, tiOpts);

		// prepare functions for killing this process
		function killer(data) {
			grunt.log.write(data);
			if (ti.killed) {
				return;
			} else if (success && success(data)) {
				ti.kill();
				grunt.log.ok('titanium run successful');
			} else if (failure && failure(data)) {
				ti.kill();
				grunt.fail.warn('titanium run failed');
			}
		}

		// listen for success or failure conditions
		if (success || failure) {
			ti.stdout.on('data', killer);
			ti.stderr.on('data', killer);
		}

		// handle titanium's exit
		ti.on('close', function(code) {
			if (command !== 'build' || options.buildOnly) {
				if (code) {
					grunt.fail.fatal('titanium ' + command + ' failed.');
				} else {
					grunt.log.ok('titanium ' + command + ' complete.');
				}
			}
			return callback(ti.killed ? null : code);
		});

		// write output to a file for analysis in test specs
		if (process.env.GRUNT_TITANIUM_TEST) {
			var testFile = path.resolve('tmp', preferGlobal ? 'tmp_global.txt' : 'tmp.txt');
			grunt.file.mkdir(path.dirname(testFile));
			fs.writeFileSync(testFile, '');
			ti.stdout.on('data', function(data) {
				fs.appendFileSync(testFile, data);
			});
		}
	}