exitCode property
The Process.exitCode of process.
When the output is caught, redirected or drained (see DartProject.runProcess), it also waits (up to 5s after the exit, in case another process keeps the pipes open) for the output to be consumed, so output and errorOutput are complete.
Implementation
Future<int> get exitCode async {
var exitCode = _exitCode;
if (exitCode != null) return exitCode;
exitCode = await process.exitCode;
if (_outputDone.isNotEmpty) {
await Future.wait(_outputDone.map((f) => f.catchError((_) {})))
.timeout(Duration(seconds: 5), onTimeout: () => []);
}
return _exitCode ??= exitCode;
}