@@ -21,19 +21,23 @@ try {
21
21
execSync ( `ssh-agent -a "${ socketPath } "` )
22
22
} catch ( e ) {
23
23
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.' ) ;
25
25
} else {
26
26
core . setFailed ( e . message ) ;
27
27
}
28
28
}
29
29
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
+ }
34
38
35
39
// Add the key and set outputs
36
- execSync ( `echo " ${ key } " | base64 -d | ssh-add -t ${ lifetimeInSeconds } -` ) ;
40
+ core . exportVariable ( 'SSH_AUTH_SOCK' , socketPath ) ;
37
41
core . setOutput ( 'socket-path' , socketPath ) ;
38
- core . setOutput ( 'agent-pid' , pid ) ;
42
+ execSync ( `echo " ${ key } " | base64 -d | ssh-add -t ${ lifetimeInSeconds } -` ) ;
39
43
core . info ( 'Done; exiting.' ) ;
0 commit comments