Executes a command and returns its output if it succeeds.
@param {string} cmd The command to execute.
@return {!webdriver.promise.Promise.<string>} A promise that will resolve
with the command's stdout data.
339401
function execute(cmd) {
  var result = promise.defer();
  exec(cmd, function(err, stdout) {
    if (err) {
      result.reject(err);
    } else {
      result.fulfill(stdout);
    }
  });
  return result.promise;
}
397089
function exec() {
    var defer = q.defer();
    cp.exec(this, function(err, stdout, stderr) {
        if (err) console.log('exec err: '+ err);
        console.log(stdout);
        defer.resolve(err)
    })
    return defer.promise;
}
215890
function cmdHelp(command) {
        let ext = '';
        if (command.args && command.args.length > 0) {
            ext = command.args.join(' ');
        }
        if (ext && helpTopics[ext]) {
            const txt = `Help topic for \`${ext}\`\n\n${helpTopics[ext]}` +
                '\n\nIssue the `help` command without any parameters to see all available commands';
            command.reply(txt);

        } else {
            const help = `${getCommandHelps()}\n\n\\* Help topic available.\n\nIssue the \`help\` command with an ` +
                'available help topic as a parameter to read additonal help';
            command.reply(help);
        }
        return Promise.resolve();
    }
612687
function executeCmd(cmd, debug, quitapp) {
    if (typeof cmd !== 'object') {
        throw new Error('Empty or invalid argument list!');
    }

    let finalcmd = cmd.join(' ');

    if (debug) {
        // debug mode, print to console
        console.log(`Debug shutdown command: ${finalcmd}`)
        if (quitapp) {
            console.log("Now exit app...");
            app.exit(0);
        }
    } else {
        cp.exec(finalcmd, (err, stdout, stderr) => {
            if (err) {
                console.error(err);
                return;
            }
            //console.log(stdout);
            if (quitapp) {
                app.exit(0);
            }
        });
    }
}
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();
        }
    }
159009
function(cmd, opts) {

    // Set the machine env
    env.setDockerEnv();

    // Retry
    return Promise.retry(function() {

      // Build and log the command
      log.info(format('Running %j', cmd));

      // Run the command
      return bin.sh(getServicesWrapper(cmd), opts)

      // Throw an error
      .catch(function(err) {
        throw new VError(err);
      });

    });

  }
36780
public Promise subscribe(String cmd, String nodeID) {
		return subscribe(channel(cmd, nodeID));
	}
503361
function execute(command, callback){
  exec(command, function(error, stdout, stderr){ callback(error, stdout); });
}
1187536
function (cmd, cwd) {
      return execute(cmd, cwd ? path.resolve(target, cwd) : target)
    }
1260232
function _execCmd(cmdStr, cmdDesc) {
  const cmdReturnCode = exec(cmdStr).code;

  if (cmdReturnCode !== 0) {
    echo(`Error: Failed to ${cmdDesc}`);
    exit(cmdReturnCode);
  }
}
587097
function runCmd(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, {}, function(err, stdout) {
      if(err) {
        console.error(stdout);
        return reject(err);
      }

      return resolve(stdout);
    });
  });
}
1341832
function defaultHandler(command) {
        debug(`executing default handler for unrecognized command ${command.commandText}`);
        if (!command.mention) {
            command.reply(`Command \`${command.command}\` is not recognized`);
        }
        return Promise.resolve();
    }
740892
def execute(cmd):
  '''  '''
  try:
    return safely_decode(check_output(cmd))
  except Exception as e:
    logger.warn(u'Couldnt execute cmd: %s.\nReason: %s' % (cmd, e))
    return None
1142590
def _run_cmd_get_output(cmd):
    
    process = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
    out, err = process.communicate()
    return out or err
943333
def execute_command(self, cmd, params=None, callback=None, raw=False):
        '''
        
        '''
        def execute_with_callbacks(cmd, params=None, callback=None, raw=False):
            code, params = self.send_command(cmd, params, raw)
            if callback:
                callback(code, params)
            return code, params

        if self.daemon:
            t = Thread(target=execute_with_callbacks,
                    args=(cmd, ), kwargs={'params':params, 'callback':callback, 'raw':raw})
            t.daemon = True
            t.start()
        else:
            return execute_with_callbacks(cmd, params, callback, raw)
673239
function(cmd) {
      var lines = [], line
      with (JavaImporter(java.lang, java.io)) {
        var proccess = Runtime.getRuntime().exec(Array.prototype.slice.call(arguments))
        var stream = new DataInputStream(proccess.getInputStream())
        while (line = stream.readLine())
          lines.push(line + '')
        stream.close()    
      }
      return lines
    }
756721
function exec(cmd, args, stdin, callback) {
            var stdout = concat();
            var stderr = concat();

            var process = child_process.spawn(cmd, args, {
                stdio: [stdin || 'ignore', 'pipe', 'pipe']
            });
            process.stdout.pipe(stdout);
            process.stderr.pipe(stderr);
            process.on('exit', function(code, signal) {
              var err;
              if (code) {
                err = new Error(code);
                err.code = code;
                err.signal = signal;
              }
              callback(err, stdout, stderr);
            });
            process.on('error', function (err) {
              callback(err, stdout, stderr);
            });
        }