run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  try {
    await handle(argResults?.arguments ?? const []);
  } catch (e, stack) {
    if (exitCode == 0) {
      exitCode = 1;
    }
    io.exitCode = exitCode;
    logger.error('❌ Command failed: $e');
    logger.debug(stack.toString());
  }
  io.exitCode = exitCode;
}