Execute ps command with positional params args and return result as 
        list of lines.
        
        @param *args: Positional params for ps command.
        @return:      List of output lines
179699
def execProcCmd(self, *args):
        
        out = util.exec_command([psCmd,] + list(args))
        return out.splitlines()
1322004
def do_echo(self, params):
        
        values = []

        with self.output_context() as context:
            for cmd in params.cmds:
                rv = self.onecmd(cmd)
                val = "" if rv is False else context.value.rstrip("\n")
                values.append(val)
                context.reset()

        try:
            self.show_output(params.fmtstr, *values)
        except TypeError:
            self.show_output("Bad format string or missing arguments.")
84827
def convert_kwargs_to_cmd_line_args(kwargs):
    """"""
    args = []
    for k in sorted(kwargs.keys()):
        v = kwargs[k]
        args.append('-{}'.format(k))
        if v is not None:
            args.append('{}'.format(v))
    return args
288701
def get_lines(command):
    
    stdout = get_output(command)
    return [line.strip().decode('utf-8') for line in stdout.splitlines()]
116460
def _run_queries(self, queries, *args, **kwargs):
        
        # write out all the commands to a temp file and then have psql run that file
        f = self._get_file()
        for q in queries:
            f.write("{};\n".format(q))
        f.close()

        psql_args = self._get_args('psql', '-X', '-f {}'.format(f.name))
        return self._run_cmd(' '.join(psql_args), *args, **kwargs)
328477
public static void executeCommand(String[] args) throws IOException {

            OptionParser parser = getParser();
            String url = null;
            Boolean confirm = false;

            // parse command-line input
            OptionSet options = parser.parse(args);
            if(options.has(AdminParserUtils.OPT_HELP)) {
                printHelp(System.out);
                return;
            }

            AdminParserUtils.checkRequired(options, AdminParserUtils.OPT_URL);

            url = (String) options.valueOf(AdminParserUtils.OPT_URL);
            if(options.has(AdminParserUtils.OPT_CONFIRM)) {
                confirm = true;
            }

            // print summary
            System.out.println("Synchronize metadata versions across all nodes");
            System.out.println("Location:");
            System.out.println("  bootstrap url = " + url);
            System.out.println("  node = all nodes");

            AdminClient adminClient = AdminToolUtils.getAdminClient(url);

            AdminToolUtils.assertServerNotInRebalancingState(adminClient);

            Versioned<Properties> versionedProps = mergeAllVersions(adminClient);

            printVersions(versionedProps);

            // execute command
            if(!AdminToolUtils.askConfirm(confirm,
                                          "do you want to synchronize metadata versions to all node"))
                return;

            adminClient.metadataMgmtOps.setMetadataVersion(versionedProps);
        }
51597
def _list_args_kwargs(self):
        

        params = []
        params.extend(self._positional_args)
        params.extend(['{k}={v}'.format(k=k, v=v) for k, v in
                       self._key_value_args.items()])

        return params
623795
def invoke(command, params={})
      command_string = compile_command(command, params)
      output_command(command_string)
      execute(command_string, params)
    end
1091439
def _execute(self, p_command, p_args):
        
        self._backup(p_command, p_args)

        command = p_command(
            p_args,
            self.todolist,
            output,
            error,
            input)

        if command.execute() != False:
            self._post_archive_action = command.execute_post_archive_actions
            return True

        return False
970927
def sort_args_by_position(*args)
      args.flatten.compact.sort_by do |arg|
        pos = arg.source_range.end_pos
        [pos.line, pos.offset]
      end
    end
174181
def _execute(self, *args: str, **kwargs) -> tuple:
        ''''''
        process = self.execute(
            args=args, options=merge_dict(self.options, kwargs))
        command = ' '.join(process.args)
        if self._dev:
            output, error = process.communicate()
            print(
                "Debug Information",
                "Command: {!r}".format(command),
                "Output: {!r}".format(output.encode('utf-8')),
                "Error: {!r}".format(error.encode('utf-8')),
                sep='\n', end='\n{}\n'.format('=' * 80)
            )
        return process.communicate()
939201
def _do_exec(self, cmd, args):
        
        if not args:
            self.stderr.write("execute: empty command\n")
            return
        proc = subprocess.Popen(subprocess.list2cmdline(args),
                shell = True, stdout = self.stdout)
        proc.wait()
1267004
def execute(cmd):
    

    # Parse cmd string to a list
    if not isinstance(cmd, list):
        cmd = shlex.split(cmd)
    # Execute command
    rc = 0
    output = ""
    try:
        output = subprocess.check_output(cmd, close_fds=True,
                                         stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as err:
        rc = err.returncode
        output = err.output
    except Exception as err:
        err_msg = ('Command "%s" Error: %s' % (' '.join(cmd), str(err)))
        raise exception.SDKInternalError(msg=err_msg)

    output = bytes.decode(output)
    return (rc, output)
1244525
def run(*args)
      stdin = nil
      cmd = SysCmd.command name do
        args.each do |arg|
          case arg
          when Hash
            arg.each do |key, value|
              next if value.nil?
              case value
              when Array
                value = value*","
              when String
                if value.include?("\n")
                  raise "Cannot pass multiple options through STDIN" if stdin
                  stdin = Support.unindent(value)
                  value = "-"
                  input stdin
                end
              end
              option key.to_s, equal_value: value
            end
          else
            option arg
          end
        end
      end
      if @context
        @context.execute cmd
      end
      cmd
    end
1263550
def run_command(self, args):
        
        parsed_args = self.parser.parse_args(args)
        if hasattr(parsed_args, 'func'):
            parsed_args.func(parsed_args)
        else:
            self.parser.print_help()
490089
private void executeCommand(String command, List<String> arguments) {

        try {
            CmsShellCommandResult result = m_remoteShell.executeCommand(command, arguments);
            m_out.print(result.getOutput());
            updateState(result);
            if (m_exitCalled) {
                exit(0);
            } else if (m_hasError && (m_errorCode != -1)) {
                exit(m_errorCode);
            }
        } catch (RemoteException r) {
            r.printStackTrace(System.err);
            exit(1);
        }
    }
604129
def positional_args(arguments):
    "
    # TODO this behaviour probably isn't quite right.
    if arguments and arguments[0] == '--':
        for a in arguments[1:]:
            yield a
    else:
        for a in arguments:
            if a.startswith('-'):
                break
            yield a