ssh: use correct profile's login scripts - fixes #6064

This commit is contained in:
Eugene Pankov 2022-04-15 19:15:27 +02:00
parent 9c6acf99d0
commit 358a7563f6
No known key found for this signature in database
GPG key ID: 5896FCBBDD1CF4F4
2 changed files with 3 additions and 4 deletions

View file

@ -200,7 +200,7 @@ export class SSHTabComponent extends BaseTerminalTabComponent {
return return
} }
const session = new SSHShellSession(this.injector, this.sshSession) const session = new SSHShellSession(this.injector, this.sshSession, this.profile)
this.setSession(session) this.setSession(session)
this.attachSessionHandler(session.serviceMessage$, msg => { this.attachSessionHandler(session.serviceMessage$, msg => {
msg = msg.replace(/\n/g, '\r\n ') msg = msg.replace(/\n/g, '\r\n ')

View file

@ -11,7 +11,6 @@ import { SSHProfile } from '../api'
export class SSHShellSession extends BaseSession { export class SSHShellSession extends BaseSession {
shell?: ClientChannel shell?: ClientChannel
private profile: SSHProfile
get serviceMessage$ (): Observable<string> { return this.serviceMessage } get serviceMessage$ (): Observable<string> { return this.serviceMessage }
private serviceMessage = new Subject<string>() private serviceMessage = new Subject<string>()
private ssh: SSHSession|null private ssh: SSHSession|null
@ -19,10 +18,10 @@ export class SSHShellSession extends BaseSession {
constructor ( constructor (
injector: Injector, injector: Injector,
ssh: SSHSession, ssh: SSHSession,
private profile: SSHProfile,
) { ) {
super(injector.get(LogService).create(`ssh-shell-${ssh.profile.options.host}-${ssh.profile.options.port}`)) super(injector.get(LogService).create(`ssh-shell-${profile.options.host}-${profile.options.port}`))
this.ssh = ssh this.ssh = ssh
this.profile = ssh.profile
this.setLoginScriptsOptions(this.profile.options) this.setLoginScriptsOptions(this.profile.options)
this.ssh.serviceMessage$.subscribe(m => this.serviceMessage.next(m)) this.ssh.serviceMessage$.subscribe(m => this.serviceMessage.next(m))
} }