Skip to content

Commit 22eaf68

Browse files
committed
SIP-253 build: support os without fuser
1 parent 4d3ab46 commit 22eaf68

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

index.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ try {
2121
execSync(`ssh-agent -a "${socketPath}"`)
2222
} catch (e) {
2323
if (e.message.includes('Address already in use')) {
24-
core.info('Agent already exists on sock. Skipping creation.');
24+
core.warning('Agent already exists on sock. Skipping creation.');
2525
} else {
2626
core.setFailed(e.message);
2727
}
2828
}
2929

30-
// Pluck the pid and set values
31-
const pid = parseInt(execSync(`fuser ${socketPath} 2> /dev/null`, {encoding: 'utf-8'}));
32-
core.exportVariable('SSH_AGENT_PID', pid);
33-
core.exportVariable('SSH_AUTH_SOCK', socketPath);
30+
// Pluck the pid and set values (if possible)
31+
try {
32+
const pid = parseInt(execSync(`fuser ${socketPath} 2> /dev/null`, {encoding: 'utf-8'}));
33+
core.exportVariable('SSH_AGENT_PID', pid);
34+
core.setOutput('agent-pid', pid);
35+
} catch (e) {
36+
core.warning('PID capture failed (fuser). Skipping...');
37+
}
3438

3539
// Add the key and set outputs
36-
execSync(`echo "${key}" | base64 -d | ssh-add -t ${lifetimeInSeconds} -`);
40+
core.exportVariable('SSH_AUTH_SOCK', socketPath);
3741
core.setOutput('socket-path', socketPath);
38-
core.setOutput('agent-pid', pid);
42+
execSync(`echo "${key}" | base64 -d | ssh-add -t ${lifetimeInSeconds} -`);
3943
core.info('Done; exiting.');

0 commit comments

Comments
 (0)