From ccf87bd083ff23f0b99793bd7c8ad37a6ddb4430 Mon Sep 17 00:00:00 2001 From: Kaiyuan Wang Date: Sat, 25 Jun 2016 12:58:46 -0700 Subject: [PATCH] Fix the issue that flutter driver does not close _peer (#4755) * Fix the issue that flutter driver does not close _peer when driver.close() is invoked. The problem introduces the following unexpected behavior: 1. Launch an app using "flutter run ..." command 2. Run the flutter driver test using "dart flutter_test.dart" The test will not exit after running. The problem will be solved if _peer is closed. * Fix formatting issue --- packages/flutter_driver/lib/src/driver.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/flutter_driver/lib/src/driver.dart b/packages/flutter_driver/lib/src/driver.dart index 0f7302ce1f..e128ab1f7a 100644 --- a/packages/flutter_driver/lib/src/driver.dart +++ b/packages/flutter_driver/lib/src/driver.dart @@ -296,10 +296,11 @@ class FlutterDriver { /// /// Returns a [Future] that fires once the connection has been closed. // TODO(yjbanov): cleanup object references - Future close() => _serviceClient.close().then((_) { + Future close() async { // Don't leak vm_service_client-specific objects, if any - return null; - }); + await _serviceClient.close(); + await _peer.close(); + } } /// Encapsulates connection information to an instance of a Flutter application.