1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-12-28 04:56:16 +03:00

only use pageant as agent if it's runing - fixes #2935, fixes #2936

This commit is contained in:
Eugene Pankov 2020-08-26 10:54:49 +02:00
parent 4346030459
commit 179acc1382
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4

View File

@ -18,6 +18,10 @@ import { SSHTabComponent } from '../components/sshTab.component'
const WINDOWS_OPENSSH_AGENT_PIPE = '\\\\.\\pipe\\openssh-ssh-agent'
try {
var windowsProcessTreeNative = require('windows-process-tree/build/Release/windows_process_tree.node') // eslint-disable-line @typescript-eslint/no-var-requires, no-var
} catch { }
@Injectable({ providedIn: 'root' })
export class SSHService {
private logger: Logger
@ -193,7 +197,14 @@ export class SSHService {
if (await fs.exists(WINDOWS_OPENSSH_AGENT_PIPE)) {
agent = WINDOWS_OPENSSH_AGENT_PIPE
} else {
agent = 'pageant'
const pageantRunning = new Promise<boolean>(resolve => {
windowsProcessTreeNative.getProcessList(list => { // eslint-disable-line block-scoped-var
resolve(list.some(x => x.name === 'pageant.exe'))
}, 0)
})
if (pageantRunning) {
agent = 'pageant'
}
}
} else {
agent = process.env.SSH_AUTH_SOCK as string