runService function
Runs a dart_service_manager action, translating its exceptions into the
CLI's CliError for a clean, stack-trace-free message.
Implementation
Future<void> runService(Future<void> Function() action) async {
try {
await action();
} on svc.ServiceAlreadyInstalledException catch (e) {
throw CliError(e.message);
} on svc.PermissionDeniedException catch (e) {
throw CliError('${e.message} (try again with elevated privileges)');
} on svc.ServiceManagerException catch (e) {
throw CliError(e.message);
}
}