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 {
  final projectType = await detectProjectType();
  if (projectType == null) {
    stderr.writeln('Could not detect project type.');
    exit(1);
  }

  final process = await runProject(projectType);
  if (process == null) {
    stderr.writeln('Failed to start the project.');
    exit(1);
  }

  // Stream stdout and stderr to console
  await Future.wait([
    stdout.addStream(process.stdout),
    stderr.addStream(process.stderr),
  ]);

  final exitCode = await process.exitCode;
  exit(exitCode);
}