Skip to content

Commit

Permalink
fix: option for agent, cleanup steps
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Gammon <[email protected]>
  • Loading branch information
sgammon committed Dec 1, 2023
1 parent 89c51f9 commit e51979b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
7 changes: 5 additions & 2 deletions dist/cleanup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function buildEffectiveOptions(options?: Partial<Options>): Options {
arch: normalizeArch(
stringOption(OptionName.ARCH, process.arch) as string
),
agent: booleanOption(OptionName.AGENT, true),
export_path: booleanOption(OptionName.EXPORT_PATH, true),
token: stringOption(OptionName.TOKEN, process.env.GITHUB_TOKEN),
custom_url: stringOption(OptionName.CUSTOM_URL)
Expand Down Expand Up @@ -260,6 +261,7 @@ export async function install(options?: Partial<Options>): Promise<void> {
}

// mount outputs
core.saveState('buildlessBinpath', outputs.path)
core.setOutput(ActionOutputName.PATH, outputs.path)
core.setOutput(ActionOutputName.VERSION, version)
core.info(`Buildless installed at version ${release.version.tag_name} 🎉`)
Expand All @@ -283,7 +285,8 @@ export async function postExecute(options?: Partial<Options>): Promise<void> {
core.info(`Cleaning up Buildless Agent and resources...`)
const agentPid = core.getState('agentPid')
const activeAgent = await agentConfig(targetOs)
if (activeAgent) {
if (agentPid) {
setBinpath(core.getState('buildlessBinpath'))
let errMessage = 'unknown'
try {
await agentStop()
Expand All @@ -293,7 +296,7 @@ export async function postExecute(options?: Partial<Options>): Promise<void> {
)
let killFailed = false
try {
process.kill(activeAgent.pid)
process.kill(activeAgent?.pid || parseInt(agentPid, 10))
} catch (err) {
killFailed = true
if (err instanceof Error) {
Expand Down

0 comments on commit e51979b

Please sign in to comment.