mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Throw an exception if flutter run fails during a microbenchmark (#9061)
This commit is contained in:
parent
0ec3ffb4bc
commit
f7d0aa03f8
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user