run method

Future run()

Implementation

Future run() async {
  if (hasBeenCancelled) return;
  progress.update("Running build_runner for $name");
  var buildProcess = await Process.start(ReedmaceCommandRunner.instance.binaryName,
      ["pub", "run", "build_runner", "build", "--delete-conflicting-outputs"],
      runInShell: true, workingDirectory: path);
  _process = buildProcess;
  StringBuffer errorOutput = StringBuffer();
  buildProcess.stdout.listen((event) {
    errorOutput.write(utf8.decode(event));
    progress.insert(() => logger.detail(utf8.decode(event).trim()));
  });
  buildProcess.stderr.listen((event) {
    errorOutput.write(utf8.decode(event));
  });
  var buildExitCode = await buildProcess.exitCode;
  if (hasBeenCancelled) return buildExitCode;
  if (buildExitCode != 0) {
    progress.fail("Failed to build $name");
    if (throwOnFail) {
      throw "Failed to build $name: ${errorOutput.toString()}";
    }
  } else {
    progress.complete("Built $name");
  }
  return buildExitCode;
}