2021-03-10 08:19:17 +01:00
|
|
|
const core = require('@actions/core');
|
2021-06-11 15:17:22 +02:00
|
|
|
const { execFileSync } = require('child_process');
|
2023-05-22 23:34:41 -07:00
|
|
|
const { sshAgentCmdDefault } = require('./paths.js');
|
2020-05-18 09:08:29 +02:00
|
|
|
|
|
|
|
try {
|
2023-05-22 23:34:41 -07:00
|
|
|
const sshAgentCmdInput = core.getInput('ssh-agent-cmd');
|
|
|
|
const sshAgentCmd = sshAgentCmdInput ? sshAgentCmdInput : sshAgentCmdDefault;
|
2020-05-18 09:08:29 +02:00
|
|
|
// Kill the started SSH agent
|
2021-03-10 08:19:17 +01:00
|
|
|
console.log('Stopping SSH agent');
|
2022-10-19 13:27:50 +02:00
|
|
|
execFileSync(sshAgentCmd, ['-k'], { stdio: 'inherit' });
|
2020-05-18 09:08:29 +02:00
|
|
|
} catch (error) {
|
2020-06-24 08:31:28 +02:00
|
|
|
console.log(error.message);
|
|
|
|
console.log('Error stopping the SSH agent, proceeding anyway');
|
2020-05-18 09:08:29 +02:00
|
|
|
}
|