run method

Future<int> run(
  1. List<String> args
)

Implementation

Future<int> run(List<String> args) async {
  try {
    // Trigger background update check (async, does not block)
    UpdateChecker.triggerBackgroundCheck(args);

    final exitCode = await runner.run(args);

    // Print update notification if a newer version is cached
    UpdateChecker.printUpdateNotificationIfNeeded(args, _logger);

    return exitCode ?? 0;
  } on UsageException catch (e) {
    _logger.err(e.message);
    _logger.info(e.usage);
    return 64; // Standard command line error code
  } catch (e) {
    _logger.err('An unexpected error occurred: $e');
    return 1;
  }
}