Allow flutter tools to detach a running Chrome session (#163349)
https://github.com/flutter/flutter/issues/163329 Tested locally to ensure pressing 'd' in a running `flutter run` session detaches and leaves Chrome open. Hitting 'q' or stopping with a signal both terminate Chrome as expected. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. --------- Co-authored-by: Nate Biggs <natebiggs@google.com>
This commit is contained in:
@@ -174,10 +174,8 @@ class ResidentWebRunner extends ResidentRunner {
|
||||
debuggingOptions.buildInfo.ddcModuleFormat != DdcModuleFormat.ddc ||
|
||||
debuggingOptions.buildInfo.canaryFeatures != true;
|
||||
|
||||
// TODO(srujzs): Return true when web supports detaching.
|
||||
// https://github.com/flutter/flutter/issues/163329
|
||||
@override
|
||||
bool get supportsDetach => false;
|
||||
bool get supportsDetach => stopAppDuringCleanup;
|
||||
|
||||
ConnectionResult? _connectionResult;
|
||||
StreamSubscription<vmservice.Event>? _stdOutSub;
|
||||
@@ -220,7 +218,11 @@ class ResidentWebRunner extends ResidentRunner {
|
||||
await _stdErrSub?.cancel();
|
||||
await _serviceSub?.cancel();
|
||||
await _extensionEventSub?.cancel();
|
||||
await device!.device!.stopApp(null);
|
||||
|
||||
if (stopAppDuringCleanup) {
|
||||
await device!.device!.stopApp(null);
|
||||
}
|
||||
|
||||
_registeredMethodsForService.clear();
|
||||
try {
|
||||
_generatedEntrypointDirectory?.deleteSync(recursive: true);
|
||||
@@ -808,7 +810,9 @@ Please provide a valid TCP port (an integer between 0 and 65535, inclusive).
|
||||
|
||||
@override
|
||||
Future<void> exitApp() async {
|
||||
await device!.exitApps();
|
||||
if (stopAppDuringCleanup) {
|
||||
await device!.exitApps();
|
||||
}
|
||||
appFinished();
|
||||
}
|
||||
|
||||
|
||||
@@ -970,9 +970,6 @@ abstract class ResidentHandlers {
|
||||
Future<void> cleanupAfterSignal();
|
||||
|
||||
/// Tear down the runner and leave the application running.
|
||||
///
|
||||
/// This is not supported on web devices where the runner is running
|
||||
/// the application server as well.
|
||||
Future<void> detach();
|
||||
|
||||
/// Tear down the runner and exit the application.
|
||||
|
||||
Reference in New Issue
Block a user