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

Method terminate

src/debug/web_debug_impl.ts:150–170  ·  view source on GitHub ↗
(force: boolean)

Source from the content-addressed store, hash-verified

148 }
149
150 protected async terminate(force: boolean): Promise<void> {
151 if (!this.appHasBeenToldToStopOrDetach) {
152 this.appHasBeenToldToStopOrDetach = true;
153 try {
154 if (this.currentRunningAppId && this.appHasStarted && !this.processExited && this.runDaemon) {
155 // Request to quit/detach, but don't await it since we sometimes
156 // don't get responses before the process quits.
157 void this.runDaemon.stop(this.currentRunningAppId);
158
159 // Now wait for the process to terminate up to 3s.
160 await Promise.race([
161 this.processExit,
162 new Promise((resolve) => setTimeout(resolve, 3000)),
163 ]);
164 }
165 } catch {
166 // Ignore failures here (we're shutting down and will send kill signals).
167 }
168 }
169 await super.terminate(force);
170 }
171
172 protected async restartRequest(
173 response: DebugProtocol.RestartResponse,

Callers 2

terminateRequestFunction · 0.80
disconnectRequestFunction · 0.80

Calls 1

stopMethod · 0.45

Tested by

no test coverage detected