ParallelCmd constructor

ParallelCmd(
  1. List<Cmd> commands
)

Implementation

ParallelCmd(this.commands)
  : super(() async {
      // When dispatched through the runtime, ParallelCmd is handled
      // specially by Program._executeCommand which runs each sub-command
      // individually so messages are delivered as each completes.
      // This closure provides a reasonable fallback for standalone use.
      final futures = commands.map((cmd) => cmd.execute());
      final results = await Future.wait(futures);
      return results.whereType<Msg>().firstOrNull;
    });