Unverified Commit 868d8c14 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

In microbenchmarks, ensure flutter quits by sending `q` to stdin (#19400)

* Tell flutter to quit directly

Fixes #19208.

* Tweak comment
parent a7b59b51
...@@ -96,7 +96,7 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -96,7 +96,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
final StreamSubscription<String> stdoutSub = process.stdout final StreamSubscription<String> stdoutSub = process.stdout
.transform(const Utf8Decoder()) .transform(const Utf8Decoder())
.transform(const LineSplitter()) .transform(const LineSplitter())
.listen((String line) { .listen((String line) async {
print(line); print(line);
if (line.contains(jsonStart)) { if (line.contains(jsonStart)) {
...@@ -124,8 +124,14 @@ Future<Map<String, double>> _readJsonResults(Process process) { ...@@ -124,8 +124,14 @@ Future<Map<String, double>> _readJsonResults(Process process) {
jsonStarted = false; jsonStarted = false;
processWasKilledIntentionally = true; processWasKilledIntentionally = true;
resultsHaveBeenParsed = true; resultsHaveBeenParsed = true;
// Sending a SIGINT/SIGTERM to the process here isn't reliable because [process] is
process.kill(ProcessSignal.sigint); // flutter run doesn't quit automatically // the shell (flutter is a shell script) and doesn't pass the signal on.
// Sending a `q` is an instruction to quit using the console runner.
// See https://github.com/flutter/flutter/issues/19208
process.stdin.write('q');
await process.stdin.flush();
// Also send a kill signal in case the `q` above didn't work.
process.kill(ProcessSignal.sigint); // ignore: deprecated_member_use
try { try {
completer.complete(new Map<String, double>.from(json.decode(jsonOutput))); completer.complete(new Map<String, double>.from(json.decode(jsonOutput)));
} catch (ex) { } catch (ex) {
......
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