mirror of
https://code.forgejo.org/actions/cache.git
synced 2025-04-02 12:57:47 +02:00
Pass earlyExit parameter to run method so tests don't hang
This commit is contained in:
parent
a29b2aba12
commit
866fe820e5
4 changed files with 32 additions and 16 deletions
12
dist/restore-only/index.js
vendored
12
dist/restore-only/index.js
vendored
|
@ -37069,24 +37069,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const restoreImpl_1 = __importDefault(__webpack_require__(835));
|
const restoreImpl_1 = __importDefault(__webpack_require__(835));
|
||||||
const stateProvider_1 = __webpack_require__(309);
|
const stateProvider_1 = __webpack_require__(309);
|
||||||
function run() {
|
function run(earlyExit) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
yield (0, restoreImpl_1.default)(new stateProvider_1.NullStateProvider());
|
yield (0, restoreImpl_1.default)(new stateProvider_1.NullStateProvider());
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
if (earlyExit) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// node will stay alive if any promises are not resolved,
|
// node will stay alive if any promises are not resolved,
|
||||||
// which is a possibility if HTTP requests are dangling
|
// which is a possibility if HTTP requests are dangling
|
||||||
// due to retries or timeouts. We know that if we got here
|
// due to retries or timeouts. We know that if we got here
|
||||||
// that all promises that we care about have successfully
|
// that all promises that we care about have successfully
|
||||||
// resolved, so simply exit with success.
|
// resolved, so simply exit with success.
|
||||||
process.exit(0);
|
if (earlyExit) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
run();
|
run(true);
|
||||||
exports.default = run;
|
exports.default = run;
|
||||||
|
|
||||||
|
|
||||||
|
|
12
dist/restore/index.js
vendored
12
dist/restore/index.js
vendored
|
@ -47625,24 +47625,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const restoreImpl_1 = __importDefault(__webpack_require__(835));
|
const restoreImpl_1 = __importDefault(__webpack_require__(835));
|
||||||
const stateProvider_1 = __webpack_require__(309);
|
const stateProvider_1 = __webpack_require__(309);
|
||||||
function run() {
|
function run(earlyExit) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
yield (0, restoreImpl_1.default)(new stateProvider_1.StateProvider());
|
yield (0, restoreImpl_1.default)(new stateProvider_1.StateProvider());
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
if (earlyExit) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// node will stay alive if any promises are not resolved,
|
// node will stay alive if any promises are not resolved,
|
||||||
// which is a possibility if HTTP requests are dangling
|
// which is a possibility if HTTP requests are dangling
|
||||||
// due to retries or timeouts. We know that if we got here
|
// due to retries or timeouts. We know that if we got here
|
||||||
// that all promises that we care about have successfully
|
// that all promises that we care about have successfully
|
||||||
// resolved, so simply exit with success.
|
// resolved, so simply exit with success.
|
||||||
process.exit(0);
|
if (earlyExit) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
run();
|
run(true);
|
||||||
exports.default = run;
|
exports.default = run;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import restoreImpl from "./restoreImpl";
|
import restoreImpl from "./restoreImpl";
|
||||||
import { StateProvider } from "./stateProvider";
|
import { StateProvider } from "./stateProvider";
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(earlyExit?: boolean | undefined): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await restoreImpl(new StateProvider());
|
await restoreImpl(new StateProvider());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
if (earlyExit) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// node will stay alive if any promises are not resolved,
|
// node will stay alive if any promises are not resolved,
|
||||||
|
@ -14,9 +16,11 @@ async function run(): Promise<void> {
|
||||||
// due to retries or timeouts. We know that if we got here
|
// due to retries or timeouts. We know that if we got here
|
||||||
// that all promises that we care about have successfully
|
// that all promises that we care about have successfully
|
||||||
// resolved, so simply exit with success.
|
// resolved, so simply exit with success.
|
||||||
process.exit(0);
|
if (earlyExit) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run(true);
|
||||||
|
|
||||||
export default run;
|
export default run;
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
import restoreImpl from "./restoreImpl";
|
import restoreImpl from "./restoreImpl";
|
||||||
import { NullStateProvider } from "./stateProvider";
|
import { NullStateProvider } from "./stateProvider";
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(earlyExit?: boolean | undefined): Promise<void> {
|
||||||
try {
|
try {
|
||||||
await restoreImpl(new NullStateProvider());
|
await restoreImpl(new NullStateProvider());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
if (earlyExit) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// node will stay alive if any promises are not resolved,
|
// node will stay alive if any promises are not resolved,
|
||||||
|
@ -14,9 +16,11 @@ async function run(): Promise<void> {
|
||||||
// due to retries or timeouts. We know that if we got here
|
// due to retries or timeouts. We know that if we got here
|
||||||
// that all promises that we care about have successfully
|
// that all promises that we care about have successfully
|
||||||
// resolved, so simply exit with success.
|
// resolved, so simply exit with success.
|
||||||
process.exit(0);
|
if (earlyExit) {
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run();
|
run(true);
|
||||||
|
|
||||||
export default run;
|
export default run;
|
||||||
|
|
Loading…
Add table
Reference in a new issue