MCPcopy Create free account
hub / github.com/Snapchat/Valdi / stop

Method stop

valdi/vscode_debugger/src/targets/node/program.ts:129–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127 }
128
129 public stop(): Promise<IStopMetadata> {
130 if (this.didStop) {
131 return this.stopped;
132 }
133 this.didStop = true;
134
135 // If we're already polling some process ID, kill it and accelerate polling
136 // so we can confirm it's dead quickly.
137 if (this.loop) {
138 killTree(this.loop.processId, this.logger);
139 this.startPollLoop(this.loop.processId, TerminalProcess.killConfirmInterval);
140 } else if (this.terminalResult.shellProcessId) {
141 // If we had a shell process ID, well, that's good enough.
142 killTree(this.terminalResult.shellProcessId, this.logger);
143 this.startPollLoop(this.terminalResult.shellProcessId, TerminalProcess.killConfirmInterval);
144 } else {
145 // Otherwise, we can't do anything. Pretend like we did.
146 this.onStopped(true);
147 }
148
149 return this.stopped;
150 }
151
152 private startPollLoop(processId: number, interval = TerminalProcess.terminationPollInterval) {
153 if (this.loop) {

Callers 1

onFirstInitializeMethod · 0.95

Calls 2

startPollLoopMethod · 0.95
killTreeFunction · 0.90

Tested by

no test coverage detected