fixup
This commit is contained in:
2 files changed
+10
-9
No files matched your search
@@ -14,6 +14,7 @@ export class SSHShellSession extends BaseSession {
|
||||
get serviceMessage$ (): Observable<string> { return this.serviceMessage }
|
||||
private serviceMessage = new Subject<string>()
|
||||
private ssh: SSHSession|null
|
||||
private writing: Promise<void> = Promise.resolve()
|
||||
|
||||
constructor (
|
||||
injector: Injector,
|
||||
@@ -98,9 +99,15 @@ export class SSHShellSession extends BaseSession {
|
||||
}
|
||||
|
||||
write (data: Buffer): void {
|
||||
if (this.shell) {
|
||||
this.shell.write(new Uint8Array(data))
|
||||
const shell = this.shell
|
||||
if (!shell) {
|
||||
return
|
||||
}
|
||||
// Each native write is its own async task; unless chained they can
|
||||
// reach the channel out of order (corrupts ZMODEM uploads).
|
||||
this.writing = this.writing
|
||||
.then(() => shell.write(new Uint8Array(data)))
|
||||
.catch(error => this.logger.debug('Shell write failed', error))
|
||||
}
|
||||
|
||||
kill (_signal?: string): void {
|
||||
|
||||
@@ -11,7 +11,6 @@ const SPACER = ' '
|
||||
|
||||
class ZModemMiddleware extends SessionMiddleware {
|
||||
private sentry: ZModem.Sentry
|
||||
private writeQueue: Promise<void> = Promise.resolve()
|
||||
private isActive = false
|
||||
private logger: Logger
|
||||
private activeSession: any = null
|
||||
@@ -62,12 +61,7 @@ class ZModemMiddleware extends SessionMiddleware {
|
||||
this.outputToTerminal.next(Buffer.from(data))
|
||||
}
|
||||
},
|
||||
sender: data => {
|
||||
const buf = Buffer.from(data)
|
||||
this.writeQueue = this.writeQueue.then(async () => {
|
||||
this.outputToSession.next(buf)
|
||||
})
|
||||
return this.writeQueue },
|
||||
sender: data => this.outputToSession.next(Buffer.from(data)),
|
||||
on_detect: async detection => {
|
||||
if ((await this.platform.showMessageBox({
|
||||
type: 'warning',
|
||||
|
||||
Reference in new issue
Block a user