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

Fix cherry-pick

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2022-06-09 15:17:52 -04:00
parent ae8f5d8537
commit fa28c073a1

View File

@ -232,19 +232,13 @@ export abstract class ShellSession {
}); });
this.websocket this.websocket
.on("message", (rawData: unknown): void => { .on("message", (data: unknown): void => {
if (!this.running) { if (!this.running) {
return void logger.debug(`[SHELL-SESSION]: received message from ${this.terminalId}, but shellProcess isn't running`); return void logger.debug(`[SHELL-SESSION]: received message from ${this.terminalId}, but shellProcess isn't running`);
} }
if (!(rawData instanceof Buffer)) {
return void logger.error(`[SHELL-SESSION]: Received message non-buffer message.`, { rawData });
}
const data = rawData.toString();
try { try {
const message: TerminalMessage = JSON.parse(data); const message: TerminalMessage = JSON.parse(String(data));
switch (message.type) { switch (message.type) {
case TerminalChannels.STDIN: case TerminalChannels.STDIN: