From 18f53866de367a75c21688cb838b36a06dbac06b Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Mon, 1 Mar 2021 08:13:10 +0000 Subject: [PATCH] Use absolute path for askpass.exe --- dist/index.js | 9 +-------- index.js | 9 +-------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index ce90adc..91db824 100644 --- a/dist/index.js +++ b/dist/index.js @@ -193,14 +193,7 @@ try { // Load key into agent var sshAdd; - try { - let sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': 'askpass' } }); - } catch (exception) { - console.log(sshAdd.toString()); - console.log(exception); - throw exception; - } - console.log(sshAdd); + child_process.execFileSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': process.cwd() + '/askpass.exe' }, stdio: 'inherit' }); 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|\')/); diff --git a/index.js b/index.js index b99bb8c..3f8995b 100644 --- a/index.js +++ b/index.js @@ -76,14 +76,7 @@ try { // Load key into agent var sshAdd; - try { - let sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': 'askpass' } }); - } catch (exception) { - console.log(sshAdd.toString()); - console.log(exception); - throw exception; - } - console.log(sshAdd); + child_process.execFileSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': process.cwd() + '/askpass.exe' }, stdio: 'inherit' }); 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|\')/);