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 {
@override
Future<void> terminateImpl() async {
if (isAttach) {
await preventBreakingAndResume();
await handleDetach();
}
// Send a request to stop/detach to give Flutter chance to do some cleanup.
......
......@@ -122,7 +122,7 @@ abstract class FlutterBaseDebugAdapter extends DartDebugAdapter<FlutterLaunchReq
@override
Future<void> disconnectImpl() async {
if (isAttach) {
await preventBreakingAndResume();
await handleDetach();
}
terminatePids(ProcessSignal.sigkill);
}
......
......@@ -561,11 +561,18 @@ void main() {
dap.client.setBreakpoint(breakpointFilePath, breakpointLine),
], eagerError: true);
// Detach.
await dap.client.terminate();
// Detach and expected resume and correct output.
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