mirror of
https://github.com/webfactory/ssh-agent.git
synced 2024-12-25 00:09:37 +00:00
Preserve process.env so the PATH (and possibly other) vars are availabe
This commit is contained in:
parent
8addcca750
commit
1606d19f15
2 changed files with 11 additions and 20 deletions
19
dist/index.js
vendored
19
dist/index.js
vendored
|
@ -119,8 +119,7 @@ const core = __webpack_require__(470);
|
|||
const child_process = __webpack_require__(129);
|
||||
const fs = __webpack_require__(747);
|
||||
const os = __webpack_require__(87);
|
||||
//const token = require('crypto').randomBytes(64).toString('hex');
|
||||
const token = 'test';
|
||||
const token = __webpack_require__(417).randomBytes(64).toString('hex');
|
||||
|
||||
try {
|
||||
const privateKey = core.getInput('ssh-private-key');
|
||||
|
@ -192,14 +191,7 @@ try {
|
|||
}
|
||||
|
||||
// Load key into agent
|
||||
let sshAdd = undefined;
|
||||
|
||||
try {
|
||||
sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': process.cwd() + '/askpass.exe' }, stdio: 'inherit', input: '' });
|
||||
} catch (exception) {
|
||||
console.log(sshAdd, exception);
|
||||
throw exception;
|
||||
}
|
||||
child_process.execFileSync('ssh-add', [keyFile], { env: { ...process.env, ...{ 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': 'D:\\a\\ssh-agent\\ssh-agent\\askpass.exe' } } });
|
||||
|
||||
output.toString().split(/\r?\n/).forEach(function(key) {
|
||||
let parts = key.match(/^Key has comment '.*\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+?)(?=\.git|\s|\')/);
|
||||
|
@ -244,6 +236,13 @@ module.exports = require("child_process");
|
|||
|
||||
/***/ }),
|
||||
|
||||
/***/ 417:
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = require("crypto");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 431:
|
||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
||||
|
||||
|
|
12
index.js
12
index.js
|
@ -2,8 +2,7 @@ const core = require('@actions/core');
|
|||
const child_process = require('child_process');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
//const token = require('crypto').randomBytes(64).toString('hex');
|
||||
const token = 'test';
|
||||
const token = require('crypto').randomBytes(64).toString('hex');
|
||||
|
||||
try {
|
||||
const privateKey = core.getInput('ssh-private-key');
|
||||
|
@ -75,14 +74,7 @@ try {
|
|||
}
|
||||
|
||||
// Load key into agent
|
||||
let sshAdd = undefined;
|
||||
|
||||
try {
|
||||
sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': process.cwd() + '/askpass.exe' }, stdio: 'inherit', input: '' });
|
||||
} catch (exception) {
|
||||
console.log(sshAdd, exception);
|
||||
throw exception;
|
||||
}
|
||||
child_process.execFileSync('ssh-add', [keyFile], { env: { ...process.env, ...{ 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': 'D:\\a\\ssh-agent\\ssh-agent\\askpass.exe' } } });
|
||||
|
||||
output.toString().split(/\r?\n/).forEach(function(key) {
|
||||
let parts = key.match(/^Key has comment '.*\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+?)(?=\.git|\s|\')/);
|
||||
|
|
Loading…
Reference in a new issue