Print the result of the command(s), if there are results to be printed.
190766
def run_on_change(res)
      messages = []
      res.each do |file|
        file = File.join( options[:watchdir].to_s,file ) if options[:watchdir]

        if options[:syntax_check]
          parser_messages = `puppet parser validate #{file} --color=false`.split("\n")
          parser_messages.reject! { |s| s =~ /puppet help parser validate/ }
          parser_messages.map! { |s| s.gsub 'err: Could not parse for environment production:', '' }

          messages += prepend_filename(parser_messages, file)
        end

        @linter.file = file
        @linter.clear_messages
        @linter.run
        linter_msg = @linter.messages.reject { |s| !options[:show_warnings] && s =~ /WARNING/ }
        messages += prepend_filename(linter_msg, file)
      end
      if messages.empty?
        messages = ["Files are ok:"] + res
        image = :success
      else
        image = :failed
      end
      Notifier.notify( messages.join("\n"), :title => "Puppet lint", :image => image )
    end
1141221
def check_results(tmp_):
        """"""
        # TODO: Fix this to work with more meaningful names
        if tmp_['t'] > 0:
            if tmp_['l'] > 0:
                if tmp_['rr'] > 0 or tmp_['ra'] > 1:
                    print 1, 3, tmp_
                    return 3
                elif tmp_['cr'] > 0 or tmp_['ca'] > 1:
                    print 2, 3, tmp_
                    return 3
                elif tmp_['mr'] > 0 or tmp_['ma'] > 1:
                    print 3, 2, tmp_
                    return 2
            if tmp_['cr'] > 1 or tmp_['ca'] > 2:
                print 4, 2, tmp_
                return 2
            if tmp_['mr'] > 0 or tmp_['ma'] > 1:
                if tmp_['cr'] > 0 or tmp_['ca'] > 1:
                    print 6, 0, tmp_
                    return 0
            if tmp_['rr'] > 1 or tmp_['ra'] > 2:
                print 7, 0, tmp_
                return 0
            if tmp_['sr'] > 1 or tmp_['sa'] > 2:
                print 8, 0, tmp_
                return 0
        if tmp_['l'] > 0:
            if tmp_['rr'] > 0 or tmp_['ra'] > 1:
                print 9, 2, tmp_
                return 2
            if tmp_['cr'] > 0 or tmp_['ca'] > 1:
                print 10, 0, tmp_
                return 0
        return -1
791361
def check_output(args):
    """"""
    log.debug('run: %s', args)
    out = subprocess.check_output(args=args).decode('utf-8')
    log.debug('out: %r', out)
    return out
814598
function print(results) {
  results.map(page => {
    if (page[1] instanceof Error) {
      printHeader('red', page[0])
      console.log(page[1].toString())
    } else {
      page[1].status > 200
        ? printHeader('red', page[0])
        : printHeader('green', page[0])
      printHtml(page[1].data)
    }
  })
}
1035440
def _run_cmd(self, command):
        
        if self.throttle:
            tables = self.engine.describe_all(False)
            limiter = self.throttle.get_limiter(tables)
        else:
            limiter = None
        self.engine.rate_limit = limiter
        results = self.engine.execute(command)
        if results is None:
            pass
        elif isinstance(results, basestring):
            print(results)
        else:
            with self.display() as ostream:
                formatter = FORMATTERS[self.conf["format"]](
                    results,
                    ostream,
                    pagesize=self.conf["pagesize"],
                    width=self.conf["width"],
                )
                formatter.display()
        print_count = 0
        total = None
        for (cmd_fragment, capacity) in self.engine.consumed_capacities:
            total += capacity
            print(cmd_fragment)
            print(indent(str(capacity)))
            print_count += 1
        if print_count > 1:
            print("TOTAL")
            print(indent(str(total)))
814351
def print_report(runner_results):
    
    error_report = collections.defaultdict(list)
    output_report = collections.defaultdict(list)
    success_report = list()
    
    for runner_info in runner_results:
        hostname = runner_info['console']
        error = runner_info['error']
        output = runner_info['output']
        
        if error:
            error_report[error].append(hostname)
        elif output:
            output_report[output].append(hostname)
        else:
            success_report.append(hostname)
            
    if error_report:
        print("Errors : ")
        for error in error_report:
            print("{0} -- [{1}] {2}".format(error.strip(), len(error_report[error]), ", ".join(error_report[error])))
            print()
    
    if output_report:        
        for output in output_report:
            print("{0} -- [{1}] {2}".format(output, len(output_report[output]), ", ".join(output_report[output])))
    
    if success_report:
        print("Completed config on {0} hosts".format(len(success_report)))
865844
def _sendResult(self, result):
        
        # logger.debug("Result: %s", result)

        try:
            result = json.dumps(result)
        except Exception as error:
            result = json.dumps(self._errorInfo(command, error))

        sys.stdout.write(result)
        sys.stdout.write("\n")
        sys.stdout.flush()
450051
def run
      result = execute(command, args: applicable_files)
      return :pass if result.success?

      result.stdout.split("\n").map(&:strip).reject(&:empty?).
        map { |error| message(error) }
    end
215358
def run_command(command):
    
    try:
        check_ouput = getattr(
            subprocess, 'check_output', subprocess.check_call)
        result = check_ouput(command, stderr=subprocess.STDOUT, shell=True)
        if check_ouput.__name__ == 'check_output':
            return 0, result
        else:
            return result, None
    except subprocess.CalledProcessError as e:
        return e.returncode, getattr(e, 'output', None)
743365
def print_command_count():
    """"""
    mdb = client.get_mdb(instance='simulator')
    for command in mdb.list_commands():
        total = 0
        for group in archive.list_command_histogram(command.qualified_name):
            for rec in group.records:
                total += rec.count
        print('  {: <40} {: >20}'.format(command, total))
998229
def execute_return_success(cmd):
    '''
    
    '''

    ret = _run_all(cmd)

    if ret['retcode'] != 0 or 'not supported' in ret['stdout'].lower():
        msg = 'Command Failed: {0}\n'.format(cmd)
        msg += 'Return Code: {0}\n'.format(ret['retcode'])
        msg += 'Output: {0}\n'.format(ret['stdout'])
        msg += 'Error: {0}\n'.format(ret['stderr'])
        raise CommandExecutionError(msg)

    return True
764276
def _print_result_info(traces, events):
    
    print_v('Returning %i traces:'%len(traces))
    for r in sorted(traces.keys()):
        x = traces[r]
        print_v('  %s (%s): %s -> %s (min: %s, max: %s, len: %i)'%(r, type(x), x[0],x[-1],min(x),max(x),len(x)))
    print_v('Returning %i events:'%len(events))
    for r in sorted(events.keys()):
        x = events[r]
        print_v('  %s: %s -> %s (len: %i)'%(r, x[0] if len(x)>0 else '-',x[-1] if len(x)>0 else '-',len(x)))
1239618
def _do_print(self, cmd, args):
        
        name = args[0].strip()
        if not name:
            self.stderr.write('TODO: Display names of inspectable objects.\n')
            return
        try:
            code = textwrap.dedent(r'''
                    self.stdout.write(name + ':\n' + textwrap.indent(pprint.pformat({}), '    ') + '\n')
                    ''').format(name).strip()
            eval(code, globals(), locals())
        except NameError:
            self.stderr.write("p: name '{}' is not defined\n".format(name))
        self.stdout.flush()
30774
function Result(cmd, err, stdout, stderr) {
  this.cmd = cmd;
  this.err = err;
  this.stdout = strip(stdout);
  this.stderr = strip(stderr);
}
244251
def command():
        
        return (
            OneOrMore(
                Word(approved_printables+' ').setResultsName('command',
                    listAllMatches=True) ^
                Grammar.__command_input_output.setResultsName('_in',
                    listAllMatches=True)
                )
            )
522109
function printResultFor(node, op) {
        return function printResult(err, res) {
            if (err) node.error(op + ' error: ' + err.toString());
            if (res) node.log(op + ' status: ' + res.constructor.name);
        };
    }
875058
def update_result_ctrl(self, event):
        """"""

        # Check to see if macro window still exists
        if not self:
            return

        printLen = 0
        self.result_ctrl.SetValue('')
        if hasattr(event, 'msg'):
            # Output of script (from print statements, for example)
            self.result_ctrl.AppendText(event.msg)
            printLen = len(event.msg)
        if hasattr(event, 'err'):
            # Error messages
            errLen = len(event.err)
            errStyle = wx.TextAttr(wx.RED)
            self.result_ctrl.AppendText(event.err)
            self.result_ctrl.SetStyle(printLen, printLen+errLen, errStyle)

        if not hasattr(event, 'err') or event.err == '':
            # No error passed.  Close dialog if user requested it.
            if self._ok_pressed:
                self.Destroy()
        self._ok_pressed = False