()
| 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) { |
no test coverage detected