mirror of
https://github.com/webfactory/ssh-agent.git
synced 2025-04-24 23:12:13 +00:00
Use cygpath to convert socket filename on windows
This commit is contained in:
parent
4512be8010
commit
895b4cdbf2
4 changed files with 16 additions and 5 deletions
3
dist/cleanup.js
vendored
3
dist/cleanup.js
vendored
|
@ -2835,7 +2835,8 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
|
|||
homePath: os.homedir(),
|
||||
sshAgentCmd: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
||||
sshAddCmd: 'c://progra~1//git//usr//bin//ssh-add.exe',
|
||||
gitCmd: 'c://progra~1//git//bin//git.exe'
|
||||
gitCmd: 'c://progra~1//git//bin//git.exe',
|
||||
pathsCmd: 'c://progra~1//git//usr//bin//cygpath.exe'
|
||||
};
|
||||
|
||||
|
||||
|
|
9
dist/index.js
vendored
9
dist/index.js
vendored
|
@ -322,7 +322,7 @@ const core = __webpack_require__(470);
|
|||
const child_process = __webpack_require__(129);
|
||||
const fs = __webpack_require__(747);
|
||||
const crypto = __webpack_require__(417);
|
||||
const { homePath, sshAgentCmd, sshAddCmd, gitCmd } = __webpack_require__(972);
|
||||
const { homePath, sshAgentCmd, sshAddCmd, gitCmd, pathsCmd } = __webpack_require__(972);
|
||||
|
||||
try {
|
||||
const privateKey = core.getInput('ssh-private-key');
|
||||
|
@ -353,6 +353,10 @@ try {
|
|||
const matches = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line);
|
||||
|
||||
if (matches && matches.length > 0) {
|
||||
// use pathsCmd to convert socket file to a windows path
|
||||
if (pathsCmd && matches[1] === "SSH_AUTH_SOCK") {
|
||||
matches[2] = child_process.execFileSync(pathsCmd, ['-m', matches[2]]).toString().trim()
|
||||
}
|
||||
// This will also set process.env accordingly, so changes take effect for this script
|
||||
core.exportVariable(matches[1], matches[2])
|
||||
console.log(`${matches[1]}=${matches[2]}`);
|
||||
|
@ -2914,7 +2918,8 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
|
|||
homePath: os.homedir(),
|
||||
sshAgentCmd: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
||||
sshAddCmd: 'c://progra~1//git//usr//bin//ssh-add.exe',
|
||||
gitCmd: 'c://progra~1//git//bin//git.exe'
|
||||
gitCmd: 'c://progra~1//git//bin//git.exe',
|
||||
pathsCmd: 'c://progra~1//git//usr//bin//cygpath.exe'
|
||||
};
|
||||
|
||||
|
||||
|
|
6
index.js
6
index.js
|
@ -2,7 +2,7 @@ const core = require('@actions/core');
|
|||
const child_process = require('child_process');
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
const { homePath, sshAgentCmd, sshAddCmd, gitCmd } = require('./paths.js');
|
||||
const { homePath, sshAgentCmd, sshAddCmd, gitCmd, pathsCmd } = require('./paths.js');
|
||||
|
||||
try {
|
||||
const privateKey = core.getInput('ssh-private-key');
|
||||
|
@ -33,6 +33,10 @@ try {
|
|||
const matches = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line);
|
||||
|
||||
if (matches && matches.length > 0) {
|
||||
// use pathsCmd to convert socket file to a windows path
|
||||
if (pathsCmd && matches[1] === "SSH_AUTH_SOCK") {
|
||||
matches[2] = child_process.execFileSync(pathsCmd, ['-m', matches[2]]).toString().trim()
|
||||
}
|
||||
// This will also set process.env accordingly, so changes take effect for this script
|
||||
core.exportVariable(matches[1], matches[2])
|
||||
console.log(`${matches[1]}=${matches[2]}`);
|
||||
|
|
3
paths.js
3
paths.js
|
@ -12,5 +12,6 @@ module.exports = (process.env['OS'] != 'Windows_NT') ? {
|
|||
homePath: os.homedir(),
|
||||
sshAgentCmd: 'c://progra~1//git//usr//bin//ssh-agent.exe',
|
||||
sshAddCmd: 'c://progra~1//git//usr//bin//ssh-add.exe',
|
||||
gitCmd: 'c://progra~1//git//bin//git.exe'
|
||||
gitCmd: 'c://progra~1//git//bin//git.exe',
|
||||
pathsCmd: 'c://progra~1//git//usr//bin//cygpath.exe'
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue