Unverified Commit 8387c238 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

[flutter_tools] Use base DAP detach and ensure correct output (#119076)

parent 22bbdf03
...@@ -354,7 +354,7 @@ class FlutterDebugAdapter extends FlutterBaseDebugAdapter { ...@@ -354,7 +354,7 @@ class FlutterDebugAdapter extends FlutterBaseDebugAdapter {
@override @override
Future<void> terminateImpl() async { Future<void> terminateImpl() async {
if (isAttach) { if (isAttach) {
await preventBreakingAndResume(); await handleDetach();
} }
// Send a request to stop/detach to give Flutter chance to do some cleanup. // Send a request to stop/detach to give Flutter chance to do some cleanup.
......
...@@ -122,7 +122,7 @@ abstract class FlutterBaseDebugAdapter extends DartDebugAdapter<FlutterLaunchReq ...@@ -122,7 +122,7 @@ abstract class FlutterBaseDebugAdapter extends DartDebugAdapter<FlutterLaunchReq
@override @override
Future<void> disconnectImpl() async { Future<void> disconnectImpl() async {
if (isAttach) { if (isAttach) {
await preventBreakingAndResume(); await handleDetach();
} }
terminatePids(ProcessSignal.sigkill); terminatePids(ProcessSignal.sigkill);
} }
......
...@@ -561,11 +561,18 @@ void main() { ...@@ -561,11 +561,18 @@ void main() {
dap.client.setBreakpoint(breakpointFilePath, breakpointLine), dap.client.setBreakpoint(breakpointFilePath, breakpointLine),
], eagerError: true); ], eagerError: true);
// Detach. // Detach and expected resume and correct output.
await dap.client.terminate(); await Future.wait(<Future<void>>[
// We should print "Detached" instead of "Exited".
dap.client.outputEvents.firstWhere((OutputEventBody event) => event.output.contains('\nDetached')),
// We should still get terminatedEvent (this signals the DAP server terminating).
dap.client.event('terminated'),
// We should get output showing the app resumed.
testProcess.output.firstWhere((String output) => output.contains('topLevelFunction')),
// Trigger the detach.
dap.client.terminate(),
]);
// Ensure we get additional output (confirming the process resumed).
await testProcess.output.first;
}); });
}); });
} }
......
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