MCPcopy Index your code
hub / github.com/Marus/cortex-debug / waitForServerExitAndRespond

Method waitForServerExitAndRespond

src/gdb.ts:1384–1415  ·  view source on GitHub ↗
(response: DebugProtocol.DisconnectResponse)

Source from the content-addressed store, hash-verified

1382 }
1383
1384 private waitForServerExitAndRespond(response: DebugProtocol.DisconnectResponse) {
1385 if (!this.server.isExternal()) {
1386 let nTimes = 60;
1387 let to = setInterval(() => {
1388 if ((nTimes === 0) || this.quit) {
1389 // We waited long enough so try to nuke the server and send VSCode a response
1390 // This is a really bad situation to be in, but not sure what else to do.
1391 clearInterval(to);
1392 to = null;
1393 this.server.exit();
1394 this.serverConsoleLog('disconnectRequest sendResponse 3');
1395 this.sendResponse(response);
1396 } else {
1397 nTimes--;
1398 }
1399 }, 10);
1400 this.server.once('exit', () => {
1401 if (to) {
1402 clearInterval(to);
1403 to = null;
1404 this.serverConsoleLog('disconnectRequest sendResponse 2');
1405 this.sendResponse(response);
1406 }
1407 });
1408 // Note: If gdb exits first, then we kill the server anyways
1409 } else {
1410 this.miDebugger.once('quit', () => {
1411 this.serverConsoleLog('disconnectRequest sendResponse 1');
1412 this.sendResponse(response);
1413 });
1414 }
1415 }
1416
1417 protected disconnectingPromise: Promise<void> = undefined;
1418 protected async disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): Promise<void> {

Callers 1

Calls 3

serverConsoleLogMethod · 0.95
isExternalMethod · 0.80
exitMethod · 0.80

Tested by

no test coverage detected