From f6c0dd6ad3d27ea251f69e666704f45a43e1180a Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sat, 12 Mar 2022 19:02:03 +0100 Subject: [PATCH] potentially fix Zmodem corruption issues --- app/lib/pty.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/lib/pty.ts b/app/lib/pty.ts index c671d512..6aab8eda 100644 --- a/app/lib/pty.ts +++ b/app/lib/pty.ts @@ -4,6 +4,7 @@ import { ipcMain } from 'electron' import { Application } from './app' import { UTF8Splitter } from './utfSplitter' import { Subject, debounceTime } from 'rxjs' +import { StringDecoder } from './stringDecoder' class PTYDataQueue { private buffers: Buffer[] = [] @@ -90,6 +91,7 @@ class PTYDataQueue { export class PTY { private pty: nodePTY.IPty private outputQueue: PTYDataQueue + private decoder = new StringDecoder() exited = false constructor (private id: string, private app: Application, ...args: any[]) { @@ -99,7 +101,7 @@ export class PTY { } this.outputQueue = new PTYDataQueue(this.pty, data => { - setImmediate(() => this.emit('data', data)) + setImmediate(() => this.emit('data', this.decoder.write(data))) }) this.pty.onData(data => this.outputQueue.push(Buffer.from(data)))