node-pty and flow control fixes - fixed #3695, fixed #3701, fixed #3696, fixed #3690

This commit is contained in:
Eugene Pankov
2021-04-16 20:15:39 +02:00
parent 8f0ba06f63
commit 4f32908c48
7 changed files with 30 additions and 25 deletions

View File

@@ -1,4 +1,4 @@
import * as nodePTY from 'node-pty'
import * as nodePTY from '@terminus-term/node-pty'
import { v4 as uuidv4 } from 'uuid'
import { ipcMain } from 'electron'
import { Application } from './app'
@@ -39,12 +39,22 @@ class PTYDataQueue {
totalLength += this.buffers[0].length
buffersToSend.push(this.buffers.shift())
}
if (buffersToSend.length == 0) {
return
}
let toSend = Buffer.concat(buffersToSend)
this.buffers.unshift(toSend.slice(this.maxChunk))
toSend = toSend.slice(0, this.maxChunk)
if (toSend.length > this.maxChunk) {
this.buffers.unshift(toSend.slice(this.maxChunk))
toSend = toSend.slice(0, this.maxChunk)
}
this.onData(toSend)
this.delta += toSend.length
this.buffers = []
if (this.buffers.length) {
setImmediate(() => this.maybeEmit())
}
}
}

View File

@@ -34,7 +34,7 @@
"mz": "^2.7.0",
"native-process-working-directory": "^1.0.2",
"ngx-toastr": "^13.2.1",
"node-pty": "^0.10.0",
"@terminus-term/node-pty": "0.10.0-terminus.3",
"npm": "6",
"path": "0.12.7",
"rxjs": "^6.6.6",

View File

@@ -44,7 +44,7 @@ module.exports = {
glasstron: 'commonjs glasstron',
mz: 'commonjs mz',
npm: 'commonjs npm',
'node-pty': 'commonjs node-pty',
'@terminus-term/node-pty': 'commonjs @terminus-term/node-pty',
path: 'commonjs path',
rxjs: 'commonjs rxjs',
'rxjs/operators': 'commonjs rxjs/operators',

View File

@@ -143,6 +143,13 @@
dependencies:
debug "^4.3.1"
"@terminus-term/node-pty@0.10.0-terminus.3":
version "0.10.0-terminus.3"
resolved "https://registry.yarnpkg.com/@terminus-term/node-pty/-/node-pty-0.10.0-terminus.3.tgz#9dbd64d52afda5079e66265a89d313fe42affab7"
integrity sha512-HvIOts22dnoBXhRfLiK9DyPasuixYVgEUvgqZmOr0B0Ki9tF8e074oYPUtzLRll6Y553QiUzTWhriCS99MChNQ==
dependencies:
nan "^2.14.0"
"@types/mz@2.7.3":
version "2.7.3"
resolved "https://registry.yarnpkg.com/@types/mz/-/mz-2.7.3.tgz#e42a21e73f5f9340fe4a176981fafb1eb8cc6c12"
@@ -250,12 +257,7 @@ ansistyles@~0.1.3:
resolved "https://registry.yarnpkg.com/ansistyles/-/ansistyles-0.1.3.tgz"
integrity sha1-XeYEFb2gcbs3EnhUyGT0GyMlRTk=
any-promise@^1.0.0:
version "1.3.0"
resolved "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz"
integrity sha1-q8av7tzqUugJzcA3au0845Y10X8=
any-promise@^1.3.0:
any-promise@^1.0.0, any-promise@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
integrity sha1-q8av7tzqUugJzcA3au0845Y10X8=
@@ -2146,13 +2148,6 @@ node-gyp@^5.0.2, node-gyp@^5.1.0:
tar "^4.4.12"
which "^1.3.1"
node-pty@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/node-pty/-/node-pty-0.10.0.tgz#c98d23967b076b35c9fb216c542a04d0b5db4821"
integrity sha512-Q65ookKbjhqWUYKmtZ6iPn0nnqNdzpm3YJOBmzwWJde/TrenBxK9FgqGGtSW0Wjz4YsR1grQF4a7RS5nBwuW9A==
dependencies:
nan "^2.14.0"
noop-logger@^0.1.1:
version "0.1.1"
resolved "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz"