1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Finetuning

Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
Lauri Nevala 2020-06-08 15:21:38 +03:00
parent 5c9fd389a9
commit 86fff0defa

View File

@ -182,16 +182,24 @@ export class ShellSession extends EventEmitter {
protected exitProcessOnWebsocketClose() { protected exitProcessOnWebsocketClose() {
this.websocket.on("close", () => { this.websocket.on("close", () => {
if (this.shellProcess) { logger.debug("Killing shell process")
logger.debug("Killing shell process") this.killShellProcess()
})
}
protected killShellProcess(){
if(this.running) {
// For windows we need to kill the shell process by pid, since Lens won't respond after a while if using `this.shellProcess.kill()`
if (process.platform == "win32") {
try { try {
process.kill(this.shellProcess.pid) process.kill(this.shellProcess.pid)
} catch(e) { } catch(e) {
logger.debug("Process id not exist") logger.debug("Process id not exist")
} }
this.emit('exit') } else {
this.shellProcess.kill()
} }
}) }
} }
protected sendResponse(msg: string) { protected sendResponse(msg: string) {