diff --git a/dist/index.js b/dist/index.js index dfa6983..e0ac980 100644 --- a/dist/index.js +++ b/dist/index.js @@ -191,10 +191,14 @@ try { } // Load key into agent - var sshAdd; + let sshAdd = undefined; - sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': process.cwd() + '/askpass.exe' }, stdio: 'inherit' }); - console.log(sshAdd.toString()); + 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; + } 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 977d403..623a093 100644 --- a/index.js +++ b/index.js @@ -74,10 +74,14 @@ try { } // Load key into agent - var sshAdd; + let sshAdd = undefined; - sshAdd = child_process.execSync(`ssh-add ${keyFile}`, { env: { 'DISPLAY': 'fake', 'SSH_PASS': token, 'SSH_ASKPASS': process.cwd() + '/askpass.exe' }, stdio: 'inherit' }); - console.log(sshAdd.toString()); + 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; + } 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|\')/);