MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / disconnectRequest

Function disconnectRequest

src/debug/dart_debug_impl.ts:521–541  ·  view source on GitHub ↗
(
		response: DebugProtocol.DisconnectResponse,
		args: DebugProtocol.DisconnectArguments,
	)

Source from the content-addressed store, hash-verified

519 }
520
521 protected async disconnectRequest(
522 response: DebugProtocol.DisconnectResponse,
523 args: DebugProtocol.DisconnectArguments,
524 ): Promise<void> {
525 this.log(`Disconnect requested!`);
526 this.isTerminating = true;
527 try {
528 const succeeded = await this.raceIgnoringErrors(() => this.terminate(false), 2000);
529 // If we hit the 2s timeout, then terminate more forcefully.
530 if (!succeeded)
531 await this.terminate(true);
532 } catch (e) {
533 return this.errorResponse(response, `${e}`);
534 }
535 // If we call super.disconnectRequest before other async code finishes, the TerminatedEvent()
536 // might not be sent, so wait as least as long as the code in the processExit handler, which is
537 // just a setImmediate after the last logging event (capped at 500).
538 await this.raceIgnoringErrors(() => this.lastLoggingEvent, 500);
539 await new Promise((resolve) => setTimeout(resolve, 10));
540 super.disconnectRequest(response, args);
541 }
542
543 protected async setBreakPointsRequest(
544 response: DebugProtocol.SetBreakpointsResponse,

Callers

nothing calls this directly

Calls 3

terminateMethod · 0.80
disconnectRequestMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected