Use execFileSync to clean up

execSync just started a second ssh-agent. `['-k']` argument was
treated as options, it didn't have `stdio` set, so stdio was piped and
returned (and ignored).
This commit is contained in:
Maciej Pasternacki 2021-06-11 14:21:18 +02:00
parent 81d965f2bd
commit fae6d5410d
No known key found for this signature in database
GPG key ID: FE0714C48663914D
2 changed files with 4 additions and 6 deletions

View file

@ -1,12 +1,11 @@
const core = require('@actions/core');
const { execSync } = require('child_process');
const { execFileSync } = require('child_process');
const { sshAgent } = require('./paths.js');
try {
// Kill the started SSH agent
console.log('Stopping SSH agent');
execSync(sshAgent, ['-k'], { stdio: 'inherit' });
execFileSync(sshAgent, ['-k'], { stdio: 'inherit' });
} catch (error) {
console.log(error.message);
console.log('Error stopping the SSH agent, proceeding anyway');