mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Do a clean shutdown of the flutter_tools processes started by observatory_port_test (#159169)
Killing the flutter_tools parent process may leak child processes spawned by the tools. Also wait for the message indicating that DevTools has started before stopping flutter_tools. If DevTools has not fully launched, then there may be a race between DevTools startup and flutter_tools shutdown. Fixes https://github.com/flutter/flutter/issues/159154
This commit is contained in:
parent
93d772c5cd
commit
d7f5547ecd
@ -26,7 +26,7 @@ Future<void> waitForVmServiceMessage(Process process, int port) async {
|
|||||||
.transform(utf8.decoder)
|
.transform(utf8.decoder)
|
||||||
.listen((String line) {
|
.listen((String line) {
|
||||||
printOnFailure(line);
|
printOnFailure(line);
|
||||||
if (line.contains('A Dart VM Service on Flutter test device is available at')) {
|
if (line.contains('The Flutter DevTools debugger and profiler on Flutter test device is available at')) {
|
||||||
if (line.contains('http://127.0.0.1:$port')) {
|
if (line.contains('http://127.0.0.1:$port')) {
|
||||||
completer.complete();
|
completer.complete();
|
||||||
} else {
|
} else {
|
||||||
@ -66,7 +66,9 @@ void main() {
|
|||||||
'flutter-tester',
|
'flutter-tester',
|
||||||
], workingDirectory: tempDir.path);
|
], workingDirectory: tempDir.path);
|
||||||
await waitForVmServiceMessage(process, port);
|
await waitForVmServiceMessage(process, port);
|
||||||
process.kill();
|
// Send a quit command to flutter_tools to cleanly shut down the tool
|
||||||
|
// and its child processes.
|
||||||
|
process.stdin.writeln('q');
|
||||||
await process.exitCode;
|
await process.exitCode;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,7 +90,7 @@ void main() {
|
|||||||
'flutter-tester',
|
'flutter-tester',
|
||||||
], workingDirectory: tempDir.path);
|
], workingDirectory: tempDir.path);
|
||||||
await waitForVmServiceMessage(process, ddsPort);
|
await waitForVmServiceMessage(process, ddsPort);
|
||||||
process.kill();
|
process.stdin.writeln('q');
|
||||||
await process.exitCode;
|
await process.exitCode;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -105,7 +107,7 @@ void main() {
|
|||||||
'flutter-tester',
|
'flutter-tester',
|
||||||
], workingDirectory: tempDir.path);
|
], workingDirectory: tempDir.path);
|
||||||
await waitForVmServiceMessage(process, ddsPort);
|
await waitForVmServiceMessage(process, ddsPort);
|
||||||
process.kill();
|
process.stdin.writeln('q');
|
||||||
await process.exitCode;
|
await process.exitCode;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user