Commit ccf87bd0 authored by Kaiyuan Wang's avatar Kaiyuan Wang Committed by Yegor

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
parent 2fa6a709
...@@ -296,10 +296,11 @@ class FlutterDriver { ...@@ -296,10 +296,11 @@ class FlutterDriver {
/// ///
/// Returns a [Future] that fires once the connection has been closed. /// Returns a [Future] that fires once the connection has been closed.
// TODO(yjbanov): cleanup object references // 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 // 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. /// Encapsulates connection information to an instance of a Flutter application.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment