mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-21 15:51:03 -05: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:
parent
346645706f
commit
42452daeb5
7 changed files with 16 additions and 8 deletions
1
dist/main/index.js
vendored
1
dist/main/index.js
vendored
|
@ -140762,6 +140762,7 @@ function run() {
|
||||||
core.info(error.stack);
|
core.info(error.stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
process.exit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
|
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
6
dist/post/index.js
vendored
6
dist/post/index.js
vendored
|
@ -138072,10 +138072,12 @@ function run() {
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if (error instanceof errors_1.PostActionJobFailure) {
|
if (error instanceof errors_1.PostActionJobFailure) {
|
||||||
core.setFailed(String(error));
|
core.setFailed(String(error));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
handleFailure(error);
|
else {
|
||||||
|
handleFailure(error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
process.exit();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
|
|
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -35,7 +35,7 @@
|
||||||
"eslint-plugin-prettier": "5.1.2",
|
"eslint-plugin-prettier": "5.1.2",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"js-yaml": "4.1.0",
|
"js-yaml": "4.1.0",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "4.1.5",
|
||||||
"patch-package": "8.0.0",
|
"patch-package": "8.0.0",
|
||||||
"prettier": "3.1.1",
|
"prettier": "3.1.1",
|
||||||
"ts-jest": "29.1.1",
|
"ts-jest": "29.1.1",
|
||||||
|
|
|
@ -29,6 +29,9 @@ export async function run(): Promise<void> {
|
||||||
core.info(error.stack)
|
core.info(error.stack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Explicit process.exit() to prevent waiting for hanging promises.
|
||||||
|
process.exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
run()
|
run()
|
||||||
|
|
|
@ -16,11 +16,13 @@ export async function run(): Promise<void> {
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof PostActionJobFailure) {
|
if (error instanceof PostActionJobFailure) {
|
||||||
core.setFailed(String(error))
|
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 {
|
function handleFailure(error: unknown): void {
|
||||||
|
|
Loading…
Reference in a new issue