Skip to content

Commit 5c6008d

Browse files
authored
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.
1 parent 315083d commit 5c6008d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎tabby-ssh/src/session/ssh.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,17 @@ export class SSHSession {
248248
private async getAgentConnectionSpec (): Promise<russh.AgentConnectionSpec|null> {
249249
if (this.hostApp.platform === Platform.Windows) {
250250
if (this.config.store.ssh.agentType === 'auto') {
251-
if (await fs.exists(WINDOWS_OPENSSH_AGENT_PIPE)) {
251+
let pipeExists = false
252+
try {
253+
await fs.stat(WINDOWS_OPENSSH_AGENT_PIPE)
254+
pipeExists = true
255+
} catch (e) {
256+
if (e.code === 'EBUSY') {
257+
pipeExists = true
258+
}
259+
}
260+
261+
if (pipeExists) {
252262
return {
253263
kind: 'named-pipe',
254264
path: WINDOWS_OPENSSH_AGENT_PIPE,

0 commit comments

Comments
 (0)