1
0
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:
Lauri Nevala 2020-04-03 19:50:41 +03:00 committed by GitHub
parent 70abf73176
commit b95e45b75b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
} }
} }
} }