mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Catch ipc errors on proxy exit (#214)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
70abf73176
commit
b95e45b75b
@ -59,7 +59,7 @@ export class KubeAuthProxy {
|
|||||||
})
|
})
|
||||||
this.proxyProcess.on("exit", (code) => {
|
this.proxyProcess.on("exit", (code) => {
|
||||||
logger.error(`proxy ${this.cluster.contextName} exited with code ${code}`)
|
logger.error(`proxy ${this.cluster.contextName} exited with code ${code}`)
|
||||||
this.sendIpcLogMessage( `proxy exited with code ${code}`, "stderr")
|
this.sendIpcLogMessage( `proxy exited with code ${code}`, "stderr").catch((_) => {})
|
||||||
this.proxyProcess = null
|
this.proxyProcess = null
|
||||||
configWatcher.close()
|
configWatcher.close()
|
||||||
})
|
})
|
||||||
@ -95,15 +95,14 @@ export class KubeAuthProxy {
|
|||||||
return errorMsg
|
return errorMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
protected sendIpcLogMessage(data: string, stream: string) {
|
protected async sendIpcLogMessage(data: string, stream: string) {
|
||||||
this.promiseIpc.send(`kube-auth:${this.cluster.id}`, findMainWebContents(), { data: data, stream: stream })
|
await this.promiseIpc.send(`kube-auth:${this.cluster.id}`, findMainWebContents(), { data: data, stream: stream })
|
||||||
}
|
}
|
||||||
|
|
||||||
public exit() {
|
public exit() {
|
||||||
if (this.proxyProcess) {
|
if (this.proxyProcess) {
|
||||||
logger.debug(`Stopping local proxy: ${this.cluster.contextName}`)
|
logger.debug(`Stopping local proxy: ${this.cluster.contextName}`)
|
||||||
this.proxyProcess.kill()
|
this.proxyProcess.kill()
|
||||||
this.proxyProcess = null
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user