Create a shorthand for Process.start then process.stdin.writeln then re-sync'ing the process
As an example, instead of doing
runCheckedSync(<String>['a', '|', 'b']);
or some such, the shortest equivalent I can figure out is:
final String outputOfA = runCheckedSync(<String>['a']);
final Process processB = await Process.start('b');
processB.stdin
..write(outputOfA)
..close();
String outputOfB;
processB.stdout
.transform<String>(UTF8.decoder)
.listen((String output) { outputOfB = output; });
processB.stderr.drain<String>();
if (await processB.exitCode != 0) {
throw something;
}
That was just the beginning T.T
Also have to mock everything process and streams related in mockito to test it as well
Does the following not work?
Process a = await Process.start('a');
Process b = await Process.start('b');
a.stdout.pipe(b.stdin);
String result = await UTF8.decodeStream(b.stdout);
if (await b.exitCode != 0) {
throw something;
}
Most helpful comment
Does the following not work?