exit terminals

pull/4837/head
filip mertens 9 months ago
parent b17129bba7
commit 7a089ebdfd
  1. 9
      apps/remixdesktop/src/plugins/xtermPlugin.ts

@ -155,10 +155,18 @@ class XtermPluginClient extends ElectronBasePluginClient {
env: env, env: env,
}) })
const dataBatcher = new DataBatcher(ptyProcess.pid) const dataBatcher = new DataBatcher(ptyProcess.pid)
this.dataBatchers[ptyProcess.pid] = dataBatcher
ptyProcess.onData((data: string) => { ptyProcess.onData((data: string) => {
dataBatcher.write(Buffer.from(data)) dataBatcher.write(Buffer.from(data))
//this.sendData(data, ptyProcess.pid) //this.sendData(data, ptyProcess.pid)
}) })
ptyProcess.onExit(() => {
const pid = ptyProcess.pid
this.terminals[pid].kill()
delete this.terminals[pid]
delete this.dataBatchers[pid]
this.emit('close', pid)
})
dataBatcher.on('flush', (data: string, uid: number) => { dataBatcher.on('flush', (data: string, uid: number) => {
this.sendData(data, uid) this.sendData(data, uid)
}) })
@ -170,6 +178,7 @@ class XtermPluginClient extends ElectronBasePluginClient {
async closeTerminal(pid: number): Promise<void> { async closeTerminal(pid: number): Promise<void> {
this.terminals[pid].kill() this.terminals[pid].kill()
delete this.terminals[pid] delete this.terminals[pid]
delete this.dataBatchers[pid]
this.emit('close', pid) this.emit('close', pid)
} }

Loading…
Cancel
Save