From 52738f5fc73247431b29e7761ce502bf901e3df2 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Mon, 29 Apr 2024 13:10:18 +0300 Subject: [PATCH] Update server.js --- web/Modules/Terminal/nodejs/terminal/server.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web/Modules/Terminal/nodejs/terminal/server.js b/web/Modules/Terminal/nodejs/terminal/server.js index 1d7f544..b136289 100644 --- a/web/Modules/Terminal/nodejs/terminal/server.js +++ b/web/Modules/Terminal/nodejs/terminal/server.js @@ -149,11 +149,9 @@ wss.on('connection', (ws, req) => { // Ensure pty is killed when websocket is closed and vice versa pty.on('exit', () => { console.log(`Ended pty (${pty.pid})`); - // if (ws.OPEN) { - // ws.close(); - // } - pty.kill(); - wss.clients.delete(ws); + if (ws.OPEN) { + ws.close(); + } }); ws.on('close', () => { console.log(`Ended connection from ${remoteIP} (${sessionID})`);