done property

Future<int> get done

A Future that completes when the process has exited and its standard output and error streams have closed.

This exists as an alternative to exitCode, which does not guarantee that the stdio streams have closed (it is possible for the exit code to be available before stdout and stderr have closed).

The future returned here will complete with the exit code of the process.

Implementation

Future<int> get done async {
  late int result;
  await Future.wait<void>(<Future<void>>[
    _stdoutDone.future,
    _stderrDone.future,
    _delegate.exitCode.then((int value) {
      result = value;
    }),
  ]);
  return result;
}