@@ -108,6 +108,7 @@ export function buildEffectiveOptions(options?: Partial<Options>): Options {
108
108
arch : normalizeArch (
109
109
stringOption ( OptionName . ARCH , process . arch ) as string
110
110
) ,
111
+ agent : booleanOption ( OptionName . AGENT , true ) ,
111
112
export_path : booleanOption ( OptionName . EXPORT_PATH , true ) ,
112
113
token : stringOption ( OptionName . TOKEN , process . env . GITHUB_TOKEN ) ,
113
114
custom_url : stringOption ( OptionName . CUSTOM_URL )
@@ -260,6 +261,7 @@ export async function install(options?: Partial<Options>): Promise<void> {
260
261
}
261
262
262
263
// mount outputs
264
+ core . saveState ( 'buildlessBinpath' , outputs . path )
263
265
core . setOutput ( ActionOutputName . PATH , outputs . path )
264
266
core . setOutput ( ActionOutputName . VERSION , version )
265
267
core . info ( `Buildless installed at version ${ release . version . tag_name } 🎉` )
@@ -283,7 +285,8 @@ export async function postExecute(options?: Partial<Options>): Promise<void> {
283
285
core . info ( `Cleaning up Buildless Agent and resources...` )
284
286
const agentPid = core . getState ( 'agentPid' )
285
287
const activeAgent = await agentConfig ( targetOs )
286
- if ( activeAgent ) {
288
+ if ( agentPid ) {
289
+ setBinpath ( core . getState ( 'buildlessBinpath' ) )
287
290
let errMessage = 'unknown'
288
291
try {
289
292
await agentStop ( )
@@ -293,7 +296,7 @@ export async function postExecute(options?: Partial<Options>): Promise<void> {
293
296
)
294
297
let killFailed = false
295
298
try {
296
- process . kill ( activeAgent . pid )
299
+ process . kill ( activeAgent ? .pid || parseInt ( agentPid , 10 ) )
297
300
} catch ( err ) {
298
301
killFailed = true
299
302
if ( err instanceof Error ) {
0 commit comments