[tools] Add update-release-info (#5643)

This commit is contained in:
stuartmorgan
2022-05-18 19:17:29 -04:00
committed by GitHub
parent ca9a81d653
commit dd2fc61b1c
10 changed files with 1238 additions and 40 deletions

View File

@ -310,14 +310,15 @@ String _pluginPlatformSection(
return entry;
}
typedef ErrorHandler = void Function(Error error);
/// Run the command [runner] with the given [args] and return
/// what was printed.
/// A custom [errorHandler] can be used to handle the runner error as desired without throwing.
Future<List<String>> runCapturingPrint(
CommandRunner<void> runner, List<String> args,
{ErrorHandler? errorHandler}) async {
CommandRunner<void> runner,
List<String> args, {
Function(Error error)? errorHandler,
Function(Exception error)? exceptionHandler,
}) async {
final List<String> prints = <String>[];
final ZoneSpecification spec = ZoneSpecification(
print: (_, __, ___, String message) {
@ -333,6 +334,11 @@ Future<List<String>> runCapturingPrint(
rethrow;
}
errorHandler(e);
} on Exception catch (e) {
if (exceptionHandler == null) {
rethrow;
}
exceptionHandler(e);
}
return prints;