run method

Future<void> run()

Implementation

Future<void> run() async {
  await saveJsonFromPath(cacheManager.configFilePath(this), configs);
  for (var i = 0; i < actions.length; i++) {
    final action = actions[i];
    final shellText = action.argument.join(' ');
    var shellName = action.name;
    final name = action.name.split('@').first;
    final ref = action.name.split('@').last;
    if (action.actionType == 'dart' && action.commandName != null) {
      shellName =
          '${Path(dcmPrefix).exePath(name, ref)} ${action.commandName} --id $id --index ${action.id}';
    }
    final shell = Shell(workingDirectory: memoryEnv['PWD']);
    final results = await shell.run('$shellName $shellText');
    for (var result in results) {
      if (result.errText.isNotEmpty) {
        logger.log(
          '[${result.exitCode}]${result.errText}',
          status: LogStatus.error,
        );
      }
    }
    if (results.any((element) => element.errText.isNotEmpty)) {
      exit(2);
    }
  }
}