import { BaseSession } from 'terminus-terminal' export interface SSHConnection { name?: string host: string port: number user: string password?: string privateKey?: string } export class SSHSession extends BaseSession { constructor (private shell: any) { super() this.open = true this.shell.on('data', data => { this.emitOutput(data.toString()) }) this.shell.on('end', () => { if (this.open) { this.destroy() } }) } resize (columns, rows) { this.shell.setWindow(rows, columns) } write (data) { this.shell.write(data) } kill (signal?: string) { this.shell.signal(signal || 'TERM') } async getChildProcesses (): Promise { return [] } async gracefullyKillProcess (): Promise { this.kill('TERM') } async getWorkingDirectory (): Promise { return null } }