( response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments, )
| 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, |
nothing calls this directly
no test coverage detected