Attempt to fix race in microbenchmark error handling code (#19092)

Await stream cancellations before trying to complete
This commit is contained in:
Danny Tuppeny
2018-07-05 13:06:43 +01:00
committed by GitHub
parent c34daae2d6
commit e1d396d5ca

View File

@@ -139,9 +139,11 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonBuf.writeln(line.substring(line.indexOf(jsonPrefix) + jsonPrefix.length));
});
process.exitCode.then<int>((int code) {
stdoutSub.cancel();
stderrSub.cancel();
process.exitCode.then<int>((int code) async {
await Future.wait<void>(<Future<void>>[
stdoutSub.cancel(),
stderrSub.cancel(),
]);
if (!processWasKilledIntentionally && code != 0) {
completer.completeError('flutter run failed: exit code=$code');
}