()
| 167 | } |
| 168 | |
| 169 | public stop(): Promise<IStopMetadata> { |
| 170 | if (this.didStop) { |
| 171 | return this.stopped; |
| 172 | } |
| 173 | this.didStop = true; |
| 174 | |
| 175 | // If we're already polling some process ID, kill it and accelerate polling |
| 176 | // so we can confirm it's dead quickly. |
| 177 | if (this.liveness) { |
| 178 | killTree(this.liveness.pid, this.logger, this.killBehavior); |
| 179 | this.liveness.updateInterval(TerminalProcess.killConfirmInterval); |
| 180 | } else if (this.terminalResult.shellProcessId) { |
| 181 | // If we had a shell process ID, well, that's good enough. |
| 182 | killTree(this.terminalResult.shellProcessId, this.logger, this.killBehavior); |
| 183 | this.liveness = new PidLiveness( |
| 184 | this.terminalResult.shellProcessId, |
| 185 | this.onStopped, |
| 186 | TerminalProcess.killConfirmInterval, |
| 187 | ); |
| 188 | } else { |
| 189 | // Otherwise, we can't do anything. Pretend like we did. |
| 190 | this.onStopped(true); |
| 191 | } |
| 192 | |
| 193 | return this.stopped; |
| 194 | } |
| 195 | } |
no test coverage detected