Validate feed, print reports and return an exit code.
182344
def RunValidationOutputToConsole(feed, options):
  """"""
  accumulator = CountingConsoleProblemAccumulator(
      options.error_types_ignore_list)
  problems = transitfeed.ProblemReporter(accumulator)
  _, exit_code = RunValidation(feed, options, problems)
  return exit_code
1206010
function callbackParser(err, out) {
	if (err) {
		error += err + '\n\n';
	} else {
		results[counter] = out;
	}

	counter++;
	if (counter === urlLength) {
		let result = {sources: [], feeds: []};
		let i = 0;
		_.each(results, feed => {
			feed.metadata.lastBuildDate = moment(feed.metadata.lastBuildDate).format('x');
			feed.metadata.update = moment(feed.metadata.update).format('x');
			result.sources.push({type: feed.type, metadata: feed.metadata});
			_.each(feed.items, function (item) {
				item.source = i;
				result.feeds.push(item);
			});
			i++;
		});

		// Sort value
		switch (allowSortValue[sortByDate]) {
			case allowSortValue.asc:
				result.feeds.sort((a, b) => (a.date > b.date) ? 1 : ((b.date > a.date) ? -1 : 0));
				break;
			case allowSortValue.desc:
				result.feeds.sort((a, b) => (a.date < b.date) ? 1 : ((b.date < a.date) ? -1 : 0));
				break;
			default:
				break;
		}

		if (error !== '') {
			finishCallback(error);
		} else {
			finishCallback(null, {feedRSSAtom: result});
		}
	}
}
1101327
function (obj) {
  printHelpOnExit = false;
  if (_.isError(obj)) {
    console.error(obj);
  } else {
    console.error(`ERROR: ${obj.toString()}`);
  }
  if (theUfo) theUfo.disconnect();
  process.exitCode = 1;
}
1182103
def print_and_exit(results):
    """"""
    for success, value in results:
        if success:
            print value.encode(locale.getpreferredencoding())
        else:
            value.printTraceback()
603555
def main():
    """"""

    reporter = BugReporter()

    print("JSON report:")
    print(reporter.as_json())
    print()

    print("Markdown report:")
    print(reporter.as_markdown())

    print("SQL report:")
    print(reporter.as_sql())

    print("Choose the appropriate format (if you're submitting a Github Issue "
          "please chose the Markdown report) and paste it!")
145588
def pretty_print(session, feed):
    
    if feed in session.feeds:
        print()
        feed_info = os.path.join(session.data_dir, feed)
        entrylinks, linkdates = parse_feed_info(feed_info)
        print(feed)
        print("-"*len(feed))
        print(''.join(["    url: ", session.feeds[feed]["url"]]))
        if linkdates != []:
            print(''.join(["    Next sync will download from: ", time.strftime(
                "%d %b %Y %H:%M:%S", tuple(max(linkdates))), "."]))
    else:
        print("You don't have a feed called {}.".format(feed), file=sys.stderr,
              flush=True)
60577
def _on_process_finished(self):
        
        exit_code = self._process.exitCode()
        if self._process.exitStatus() != self._process.NormalExit:
            exit_code = 139
        self._formatter.append_message('\x1b[0m\nProcess finished with exit code %d' % exit_code,
                                       output_format=OutputFormat.CustomFormat)
        self.setReadOnly(True)
        self.process_finished.emit()
207954
def main(reraise_exceptions=False, **kwargs):
    """"""
    exit_status = 0

    try:
        cli.main(**kwargs)
    except SoftLayer.SoftLayerAPIError as ex:
        if 'invalid api token' in ex.faultString.lower():
            print("Authentication Failed: To update your credentials, use 'slcli config setup'")
            exit_status = 1
        else:
            print(str(ex))
            exit_status = 1
    except SoftLayer.SoftLayerError as ex:
        print(str(ex))
        exit_status = 1
    except exceptions.CLIAbort as ex:
        print(str(ex.message))
        exit_status = ex.code
    except Exception:
        if reraise_exceptions:
            raise

        import traceback
        print("An unexpected error has occured:")
        print(str(traceback.format_exc()))
        print("Feel free to report this error as it is likely a bug:")
        print("    https://github.com/softlayer/softlayer-python/issues")
        print("The following snippet should be able to reproduce the error")
        exit_status = 1

    sys.exit(exit_status)
689603
def err_exit(msg, rc=1):
    
    print(msg, file=sys.stderr)
    sys.exit(rc)
155243
def postloop(self) -> None:
        """"""
        code = self.exit_code if self.exit_code is not None else 0
        self.poutput('{!r} exiting with code: {}'.format(sys.argv[0], code))
919375
def x(*args, **kwargs):
    '''
    
    '''
    with Reflect.context(args, **kwargs) as r:
        instance = V_CLASS(r, stream, **kwargs)
        if args:
            instance()

        else:
            instance.writelines([
                'exit at line {}\n'.format(instance.reflect.info["line"]),
                instance.path_value()
            ])

    exit_code = 1
    sys.exit(exit_code)
1268896
def error(message, code=1):
    """"""
    if message:
        print('ERROR: {0}'.format(message), file=sys.stderr)
    else:
        print(file=sys.stderr)
    sys.exit(code)
1268845
def out(msg, error=False):
        "  "
        pipe = stdout
        if error:
            pipe = stderr
            msg = color_msg(msg, "warning")

        pipe.write("%s\n" % msg)
822290
private void printHelpAndExit(int exitCode) {
    HelpFormatter hf = new HelpFormatter();

    hf.printHelp("gobblin-admin.sh <command> [options]", this.options);
    System.out.println("Valid commands:");
    for (String command : getCommandNames()) {
      System.out.println(command);
    }

    System.exit(exitCode);
  }
1355657
def RunValidationOutputFromOptions(feed, options):
  """"""
  if options.output.upper() == "CONSOLE":
    return RunValidationOutputToConsole(feed, options)
  else:
    return RunValidationOutputToFilename(feed, options, options.output)
251090
def run(self):
        """"""
        self.exit_code = 1
        self.mainloop = GLib.MainLoop()
        try:
            future = ensure_future(self._start_async_tasks())
            future.callbacks.append(self.set_exit_code)
            self.mainloop.run()
            return self.exit_code
        except KeyboardInterrupt:
            return 1
1327911
def check_returncode(self):
        """"""
        if self.returncode:
            raise CalledProcessError(self.returncode, self.args, self.stdout,
                                     self.stderr)