run method

  1. @visibleForTesting
  2. @override
Future<void> run()
inherited

Runs this command.

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

Implementation

@visibleForTesting
@override
Future<void> run() async {
  try {
    await init();
    await execute();
    hasRun = true;
  } catch (e, st) {
    await exitWithException(e, st);
  }

  // Ensure that dispose runs always
  try {
    await dispose();
    await exitWithCode(0);
  } catch (e, st) {
    await exitWithException(e, st);
  }
}