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

Function terminateRequest

src/debug/dart_debug_impl.ts:490–519  ·  view source on GitHub ↗
(
		response: DebugProtocol.TerminateResponse,
		args: DebugProtocol.TerminateArguments,
	)

Source from the content-addressed store, hash-verified

488 }
489
490 protected async terminateRequest(
491 response: DebugProtocol.TerminateResponse,
492 args: DebugProtocol.TerminateArguments,
493 ): Promise<void> {
494 this.log(`Termination requested!`);
495 this.isTerminating = true;
496 this.startProgress(debugTerminatingProgressId, "Terminating debug session");
497
498 if (this.expectAdditionalPidToTerminate && !this.additionalPidsToTerminate.size) {
499 this.log(`Waiting for main process PID before terminating`);
500 this.updateProgress(debugTerminatingProgressId, "Waiting for process");
501 const didGetPid = await this.raceIgnoringErrors(() => this.additionalPidCompleter.promise, 20000);
502 if (didGetPid)
503 this.log(`Got main process PID, continuing...`);
504 else
505 this.log(`Timed out waiting for main process PID, continuing anyway...`);
506 this.updateProgress(debugTerminatingProgressId, "Terminating process");
507 }
508
509 // If we wait for terminate() to complete, VS code will report a timeout after 1000ms
510 // so we have to acknowledge the request even if it takes longer to complete.
511 super.terminateRequest(response, args);
512
513 try {
514 await this.terminate(false);
515 } catch (e: any) {
516 this.logger.error(e);
517 this.logToUser(errorString(e));
518 }
519 }
520
521 protected async disconnectRequest(
522 response: DebugProtocol.DisconnectResponse,

Callers

nothing calls this directly

Calls 6

errorStringFunction · 0.90
startProgressMethod · 0.80
terminateRequestMethod · 0.80
terminateMethod · 0.80
errorMethod · 0.65
logMethod · 0.45

Tested by

no test coverage detected