1
0
mirror of https://github.com/Eugeny/tabby.git synced 2025-06-24 21:40:06 +00:00
2018-01-04 21:13:46 +01:00

53 lines
1010 B
TypeScript

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<any[]> {
return []
}
async gracefullyKillProcess (): Promise<void> {
this.kill('TERM')
}
async getWorkingDirectory (): Promise<string> {
return null
}
}