runOrFail function
Runs a command and throws if it fails.
Implementation
Future<void> runOrFail(
String executable,
List<String> args, {
String? workingDirectory,
String? errorMessage,
bool silent = false,
}) async {
final code = await runCommand(
executable,
args,
workingDirectory: workingDirectory,
silent: silent,
);
if (code != 0) {
Logger.error(
errorMessage ?? '$executable ${args.join(' ')} failed (exit $code)');
exit(code);
}
}