streamProcess function

Stream<String> streamProcess(
  1. String executable,
  2. List<String> args, {
  3. String? workingDirectory,
})

Runs executable and returns a stream of its interleaved stdout/stderr.

Implementation

Stream<String> streamProcess(String executable, List<String> args, {String? workingDirectory}) async* {
  final process = await Process.start(executable, args, workingDirectory: workingDirectory);

  yield* _interleave(
    process.stdout.transform(utf8.decoder).transform(const LineSplitter()),
    process.stderr.transform(utf8.decoder).transform(const LineSplitter()),
  );
}