Commit f7d0aa03 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Throw an exception if flutter run fails during a microbenchmark (#9061)

parent 0ec3ffb4
......@@ -79,6 +79,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
StreamSubscription<String> stdoutSub;
int prefixLength = 0;
bool processKilled = false;
stdoutSub = process.stdout
.transform(const Utf8Decoder())
.transform(const LineSplitter())
......@@ -94,6 +95,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
if (line.contains(jsonEnd)) {
jsonStarted = false;
stdoutSub.cancel();
processKilled = true;
process.kill(ProcessSignal.SIGINT); // flutter run doesn't quit automatically
completer.complete(JSON.decode(jsonBuf.toString()));
return;
......@@ -103,5 +105,11 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonBuf.writeln(line.substring(prefixLength));
});
process.exitCode.then<int>((int code) {
if (!processKilled && code != 0) {
completer.completeError('flutter run failed: exit code=$code');
}
});
return completer.future;
}
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