pipe static method
Runs the commands one after another, each reading the output of the one before. It stops at the first failure and answers that result.
Implementation
static Future<ProcessResultData> pipe(
List<List<String>> commands, {
String? workingDirectory,
Map<String, String>? environment,
Duration? timeout = const Duration(seconds: 60),
}) async {
if (commands.isEmpty) {
throw ArgumentError.value(commands, 'commands', 'Empty pipe');
}
ProcessResultData? previous;
for (final command in commands) {
previous = await run(
command,
workingDirectory: workingDirectory,
environment: environment,
timeout: timeout,
input: previous?.output,
);
if (previous.failed) {
break;
}
}
return previous!;
}