In microbenchmarks, ensure flutter quits by sending q to stdin (#19400)
* Tell flutter to quit directly Fixes #19208. * Tweak comment
This commit is contained in:
@@ -96,7 +96,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
final StreamSubscription<String> stdoutSub = process.stdout
|
||||
.transform(const Utf8Decoder())
|
||||
.transform(const LineSplitter())
|
||||
.listen((String line) {
|
||||
.listen((String line) async {
|
||||
print(line);
|
||||
|
||||
if (line.contains(jsonStart)) {
|
||||
@@ -124,8 +124,14 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
jsonStarted = false;
|
||||
processWasKilledIntentionally = true;
|
||||
resultsHaveBeenParsed = true;
|
||||
|
||||
process.kill(ProcessSignal.sigint); // flutter run doesn't quit automatically
|
||||
// Sending a SIGINT/SIGTERM to the process here isn't reliable because [process] is
|
||||
// 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 {
|
||||
completer.complete(new Map<String, double>.from(json.decode(jsonOutput)));
|
||||
} catch (ex) {
|
||||
|
||||
Reference in New Issue
Block a user