Skip to content

Commit d7f5547

Browse files
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 flutter/flutter#159154
1 parent 93d772c commit d7f5547

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/flutter_tools/test/integration.shard/observatory_port_test.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Future<void> waitForVmServiceMessage(Process process, int port) async {
2626
.transform(utf8.decoder)
2727
.listen((String line) {
2828
printOnFailure(line);
29-
if (line.contains('A Dart VM Service on Flutter test device is available at')) {
29+
if (line.contains('The Flutter DevTools debugger and profiler on Flutter test device is available at')) {
3030
if (line.contains('http://127.0.0.1:$port')) {
3131
completer.complete();
3232
} else {
@@ -66,7 +66,9 @@ void main() {
6666
'flutter-tester',
6767
], workingDirectory: tempDir.path);
6868
await waitForVmServiceMessage(process, port);
69-
process.kill();
69+
// Send a quit command to flutter_tools to cleanly shut down the tool
70+
// and its child processes.
71+
process.stdin.writeln('q');
7072
await process.exitCode;
7173
});
7274

@@ -88,7 +90,7 @@ void main() {
8890
'flutter-tester',
8991
], workingDirectory: tempDir.path);
9092
await waitForVmServiceMessage(process, ddsPort);
91-
process.kill();
93+
process.stdin.writeln('q');
9294
await process.exitCode;
9395
});
9496

@@ -105,7 +107,7 @@ void main() {
105107
'flutter-tester',
106108
], workingDirectory: tempDir.path);
107109
await waitForVmServiceMessage(process, ddsPort);
108-
process.kill();
110+
process.stdin.writeln('q');
109111
await process.exitCode;
110112
});
111113

0 commit comments

Comments
 (0)