Shut down DevTools and DDS processes if flutter_tools is killed by a signal (#159238)

See https://github.com/flutter/flutter/issues/159154
This commit is contained in:
Jason Simmons
2024-11-21 09:53:57 -08:00
committed by GitHub
parent c7dd6419d9
commit efe8737ea0
4 changed files with 14 additions and 6 deletions

View File

@@ -69,7 +69,6 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
final ResidentRunner _residentRunner;
final Logger _logger;
bool _shutdown = false;
bool _served = false;
@visibleForTesting
bool launchedInBrowser = false;
@@ -105,7 +104,6 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
_devToolsLauncher.devToolsUrl = devToolsServerAddress;
} else {
await _devToolsLauncher.serve();
_served = true;
}
await _devToolsLauncher.ready;
// Do not attempt to print debugger list if the connection has failed or if we're shutting down.
@@ -305,7 +303,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
@override
Future<void> shutdown() async {
_shutdown = true;
if (_devToolsLauncher == null || !_served) {
if (_devToolsLauncher == null) {
return;
}
_readyToAnnounce = false;

View File

@@ -1248,8 +1248,10 @@ class HotRunner extends ResidentRunner {
@override
Future<void> cleanupAfterSignal() async {
await residentDevtoolsHandler!.shutdown();
await stopEchoingDeviceLog();
await hotRunnerConfig!.runPreShutdownOperations();
shutdownDartDevelopmentService();
if (stopAppDuringCleanup) {
return exitApp();
}