mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-14 15:02:39 +08:00
Add explicit process.exit()
to avoid wait for hanging promises
When using the `@actions/cache` library to save cache entries, it seems that one or more Promises remain unresolved after the save completes. With Node20 this causes a delay when exiting the process: the default behaviour now wait for these Promises to complete. Adding an explicit `Process.exit()` removes the delay, returning to the Node 16 behaviour. Fixes #1038
This commit is contained in:
@@ -29,6 +29,9 @@ export async function run(): Promise<void> {
|
||||
core.info(error.stack)
|
||||
}
|
||||
}
|
||||
|
||||
// Explicit process.exit() to prevent waiting for hanging promises.
|
||||
process.exit()
|
||||
}
|
||||
|
||||
run()
|
||||
|
@@ -16,11 +16,13 @@ export async function run(): Promise<void> {
|
||||
} catch (error) {
|
||||
if (error instanceof PostActionJobFailure) {
|
||||
core.setFailed(String(error))
|
||||
return
|
||||
} else {
|
||||
handleFailure(error)
|
||||
}
|
||||
|
||||
handleFailure(error)
|
||||
}
|
||||
|
||||
// Explicit process.exit() to prevent waiting for promises left hanging by `@actions/cache` on save.
|
||||
process.exit()
|
||||
}
|
||||
|
||||
function handleFailure(error: unknown): void {
|
||||
|
Reference in New Issue
Block a user