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
This commit is contained in:
@@ -296,10 +296,11 @@ class FlutterDriver {
|
||||
///
|
||||
/// Returns a [Future] that fires once the connection has been closed.
|
||||
// TODO(yjbanov): cleanup object references
|
||||
Future<Null> close() => _serviceClient.close().then((_) {
|
||||
Future<Null> 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.
|
||||
|
||||
Reference in New Issue
Block a user