mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix crash on terminal close
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
d73df7fe0d
commit
223149d13c
@ -269,6 +269,10 @@ export abstract class ShellSession {
|
||||
break;
|
||||
}
|
||||
} catch (error) {
|
||||
if (error?.message === "ioctl(2) failed, EBADF") {
|
||||
return;
|
||||
}
|
||||
|
||||
logger.error(`[SHELL-SESSION]: failed to handle message for ${this.terminalId}`, error);
|
||||
}
|
||||
})
|
||||
|
||||
@ -143,11 +143,14 @@ export class WebSocketApi<Events extends WebSocketEvents> extends (EventEmitter
|
||||
}
|
||||
|
||||
destroy() {
|
||||
if (!this.socket) return;
|
||||
if (!this.socket) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.clearAllListeners();
|
||||
this.socket.close();
|
||||
this.socket = null;
|
||||
this.pendingCommands = [];
|
||||
this.clearAllListeners();
|
||||
clearTimeout(this.reconnectTimer);
|
||||
clearInterval(this.pingTimer);
|
||||
this.readyState = WebSocketApiState.PENDING;
|
||||
@ -197,7 +200,8 @@ export class WebSocketApi<Events extends WebSocketEvents> extends (EventEmitter
|
||||
if (error) {
|
||||
const { reconnectDelay } = this.params;
|
||||
|
||||
if (reconnectDelay) {
|
||||
// Only reconnect if the socket is still present (wasn't a WebSocket.destory() call)
|
||||
if (reconnectDelay && this.socket) {
|
||||
const url = this.socket.url;
|
||||
|
||||
this.writeLog("will reconnect in", `${reconnectDelay}s`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user