Unverified Commit f94fa278 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Stop the DevTools child process if the runner terminates unexpectedly (#80602)

parent 95d7d671
......@@ -208,6 +208,8 @@ NoOpDevtoolsHandler createNoOpHandler(DevtoolsLauncher launcher, ResidentRunner
@visibleForTesting
class NoOpDevtoolsHandler implements ResidentDevtoolsHandler {
bool wasShutdown = false;
@override
DevToolsServerAddress get activeDevToolsServer => null;
......@@ -223,6 +225,7 @@ class NoOpDevtoolsHandler implements ResidentDevtoolsHandler {
@override
Future<void> shutdown() async {
wasShutdown = true;
return;
}
}
......@@ -204,6 +204,7 @@ class ColdRunner extends ResidentRunner {
await flutterDevice.device.dispose();
}
await residentDevtoolsHandler.shutdown();
await stopEchoingDeviceLog();
}
......
......@@ -1163,6 +1163,7 @@ class HotRunner extends ResidentRunner {
await flutterDevice.device.dispose();
}
await _cleanupDevFS();
await residentDevtoolsHandler.shutdown();
await stopEchoingDeviceLog();
}
}
......
......@@ -2452,6 +2452,21 @@ void main() {
expect(nextPlatform('macOS'), 'android');
expect(() => nextPlatform('unknown'), throwsAssertionError);
});
testUsingContext('cleanupAtFinish shuts down resident devtools handler', () => testbed.run(() async {
residentRunner = HotRunner(
<FlutterDevice>[
mockFlutterDevice,
],
stayResident: false,
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug, vmserviceOutFile: 'foo'),
target: 'main.dart',
devtoolsHandler: createNoOpHandler,
);
await residentRunner.cleanupAtFinish();
expect((residentRunner.residentDevtoolsHandler as NoOpDevtoolsHandler).wasShutdown, true);
}));
}
class MockFlutterDevice extends Mock implements FlutterDevice {}
......
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