fix(ssh): fix windows openssh agent detection logic (#10954)

On Windows, checking for the existence of the OpenSSH agent named pipe
(`\\.\pipe\openssh-ssh-agent`) can throw an `EBUSY` error if the agent
is running and the pipe is in use. Previously, this error was caught
generically and treated as the pipe not existing, causing auto-detection
to fail even when the agent was active.

This change updates the detection logic to explicitly catch `EBUSY`
errors from `fs.stat` and treat them as a positive signal that the
pipe exists.
This commit is contained in:
Andy_Allan
2026-01-03 15:43:50 +01:00
committed by GitHub
parent 315083dd69
commit 5c6008deac
+11 -1
View File
@@ -248,7 +248,17 @@ export class SSHSession {
private async getAgentConnectionSpec (): Promise<russh.AgentConnectionSpec|null> {
if (this.hostApp.platform === Platform.Windows) {
if (this.config.store.ssh.agentType === 'auto') {
if (await fs.exists(WINDOWS_OPENSSH_AGENT_PIPE)) {
let pipeExists = false
try {
await fs.stat(WINDOWS_OPENSSH_AGENT_PIPE)
pipeExists = true
} catch (e) {
if (e.code === 'EBUSY') {
pipeExists = true
}
}
if (pipeExists) {
return {
kind: 'named-pipe',
path: WINDOWS_OPENSSH_AGENT_PIPE,