runPub function
Implementation
Future<void> runPub(ReedmaceCommand command, Directory directory, List<String> subcommand) async {
var directoryName =
directory.uri.pathSegments.where((element) => element.isNotEmpty).last;
var progress = command.logger.interruptibleProgress(
"Running ${subcommand.join(" ")} get in ${styleBold.wrap(directoryName)}");
var process = await Process.start(ReedmaceCommandRunner.instance.binaryName, ["pub", ...subcommand],
workingDirectory: directory.path);
process.stdout.listen((event) {
progress.insert(() => command.logger.detail(utf8.decode(event).trim()));
});
process.stderr.listen((event) {
progress.insert(() => command.logger.detail(utf8.decode(event).trim()));
});
var pubExitCode = await process.exitCode;
if (pubExitCode != 0) {
command.flagFailGlobal();
progress.fail(
"Failed to resolve dependencies for ${styleBold.wrap(directoryName)}");
} else {
progress.complete(
"Finished resolving dependencies for ${styleBold.wrap(directoryName)}");
}
}