Skip to content

Commit

Permalink
SSH Agent support on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
sedwards2009 committed Jun 26, 2024
1 parent bdf5251 commit 4b39af4
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import * as child_process from "node:child_process";
import * as fs from "node:fs";
import * as os from "node:os";
import * as path from "node:path";

Expand All @@ -30,6 +31,8 @@ interface SSHSessionConfiguration extends SessionConfiguration {
verboseLogging?: boolean;
}

const WINDOW_SSH_AUTH_SOCK = "\\\\.\\pipe\\openssh-ssh-agent";

class SSHBackend implements SessionBackend {

constructor(private _log: Logger) {
Expand Down Expand Up @@ -102,6 +105,9 @@ class SSHBackend implements SessionBackend {
}

if (process.platform === "win32") {
if (fs.existsSync(WINDOW_SSH_AUTH_SOCK)) {
return WINDOW_SSH_AUTH_SOCK;
}
return undefined;
} else {
return process.env.SSH_AUTH_SOCK;
Expand Down

0 comments on commit 4b39af4

Please sign in to comment.