runCommands method
Future<ExitCode>
runCommands(
- Iterable<
CommandToRun> commandsToRun, { - required bool runConcurrently,
- required bool bail,
Implementation
Future<ExitCode> runCommands(
Iterable<CommandToRun> commandsToRun, {
required bool runConcurrently,
required bool bail,
}) async {
if (runConcurrently) {
for (final command in commandsToRun) {
logger.detail('Script: ${darkGray.wrap(command.command)}');
}
final exitCodes = await runManyScripts.run(
commands: commandsToRun.toList(),
sequentially: false,
label: 'Running tests ',
bail: bail,
);
exitCodes.printErrors(commandsToRun, logger);
return exitCodes.exitCode(logger);
}
ExitCode? exitCode;
for (final command in commandsToRun) {
logger.detail(command.command);
final stopwatch = Stopwatch()..start();
logger.info(darkGray.wrap(command.label));
final result = await runOneScript.run(
command: command,
showOutput: true,
filter: command.filterOutput,
);
final time = (stopwatch..stop()).format();
logger
..info('Finished in ${cyan.wrap(time)}')
..write('\n');
if (result.exitCodeReason != ExitCode.success) {
exitCode = result.exitCodeReason;
if (bail || command.bail) {
return exitCode;
}
}
}
return exitCode ?? ExitCode.success;
}