1
0
mirror of https://github.com/Eugeny/tabby.git synced 2025-07-19 18:07:58 +00:00

potentially fix Zmodem corruption issues

This commit is contained in:
Eugene Pankov
2022-03-12 19:02:03 +01:00
parent 2c00b9a4bc
commit f6c0dd6ad3

@@ -4,6 +4,7 @@ import { ipcMain } from 'electron'
import { Application } from './app' import { Application } from './app'
import { UTF8Splitter } from './utfSplitter' import { UTF8Splitter } from './utfSplitter'
import { Subject, debounceTime } from 'rxjs' import { Subject, debounceTime } from 'rxjs'
import { StringDecoder } from './stringDecoder'
class PTYDataQueue { class PTYDataQueue {
private buffers: Buffer[] = [] private buffers: Buffer[] = []
@@ -90,6 +91,7 @@ class PTYDataQueue {
export class PTY { export class PTY {
private pty: nodePTY.IPty private pty: nodePTY.IPty
private outputQueue: PTYDataQueue private outputQueue: PTYDataQueue
private decoder = new StringDecoder()
exited = false exited = false
constructor (private id: string, private app: Application, ...args: any[]) { constructor (private id: string, private app: Application, ...args: any[]) {
@@ -99,7 +101,7 @@ export class PTY {
} }
this.outputQueue = new PTYDataQueue(this.pty, data => { 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))) this.pty.onData(data => this.outputQueue.push(Buffer.from(data)))