Fix test so it doesn't leak frontend_server process (#24360)
* Fix test so it doesn't leak frontend_server process
* Stop FlutterTestDriver even if expectation is not met
diff --git a/packages/flutter_tools/test/integration/flutter_run_test.dart b/packages/flutter_tools/test/integration/flutter_run_test.dart
index fa594cf..b685e1f 100644
--- a/packages/flutter_tools/test/integration/flutter_run_test.dart
+++ b/packages/flutter_tools/test/integration/flutter_run_test.dart
@@ -52,7 +52,11 @@
test('writes pid-file', () async {
final File pidFile = tempDir.childFile('test.pid');
await _flutter.run(pidFile: pidFile);
- expect(pidFile.existsSync(), isTrue);
+ try {
+ expect(pidFile.existsSync(), isTrue);
+ } finally {
+ await _flutter.stop();
+ }
});
}, timeout: const Timeout.factor(6));
}