pipe static method
Implementation
static Future<String> pipe(List<Process> processList) async {
if (processList.isEmpty) {
} else if (processList.length == 1) {
return '';
}
for (var index = 1; index <= processList.length - 1; index++) {
processList[index - 1].stdout.pipe(processList[index].stdin);
}
if (await processList.last.exitCode != 0) {
throw Exception(
'Error: ${await processList.last.stderr.transform(utf8.decoder).join()}');
}
final result = await processList.last.stdout.transform(utf8.decoder).join();
return result;
}