Unverified Commit e1d396d5 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

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

Await stream cancellations before trying to complete
parent c34daae2
...@@ -139,9 +139,11 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -139,9 +139,11 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonBuf.writeln(line.substring(line.indexOf(jsonPrefix) + jsonPrefix.length)); jsonBuf.writeln(line.substring(line.indexOf(jsonPrefix) + jsonPrefix.length));
}); });
process.exitCode.then<int>((int code) { process.exitCode.then<int>((int code) async {
stdoutSub.cancel(); await Future.wait<void>(<Future<void>>[
stderrSub.cancel(); stdoutSub.cancel(),
stderrSub.cancel(),
]);
if (!processWasKilledIntentionally && code != 0) { if (!processWasKilledIntentionally && code != 0) {
completer.completeError('flutter run failed: exit code=$code'); completer.completeError('flutter run failed: exit code=$code');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment