mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-26 23:39:13 +00:00
41e2689b18
* fix: exit non-zero after an unhandled rejection A rejection before start() runs, such as a missing production dependency at import time, was logged and then exited 0. Discussion: https://github.com/renovatebot/renovate/discussions/45894 * fix: use nullish assignment for the exit code
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import 'source-map-support/register.js';
|
|
import './punycode.cjs';
|
|
|
|
void (async (): Promise<void> => {
|
|
// ⚠️ Don't add code before this!
|
|
// This has to be imported before logger and other libraries which are instrumented.
|
|
const otel = await import('./instrumentation/index.ts');
|
|
otel.init();
|
|
|
|
const logger = await import('./logger/index.ts');
|
|
/* v8 ignore next -- not easily testable */
|
|
process.on('unhandledRejection', (err) => {
|
|
logger.logger.error({ err }, 'unhandledRejection');
|
|
process.exitCode ??= 1;
|
|
});
|
|
await logger.init();
|
|
|
|
(await import('./proxy.ts')).bootstrap();
|
|
|
|
// prints and exits the process if --version or --help is passed
|
|
const { parseEarlyFlags } =
|
|
await import('./workers/global/config/parse/cli.ts');
|
|
|
|
parseEarlyFlags();
|
|
|
|
const { start } = await import('./workers/global/index.ts');
|
|
process.exitCode = await otel.instrument('run', start);
|
|
await otel.shutdown(); //gracefully shutdown OpenTelemetry
|
|
|
|
/* v8 ignore if -- no test required */
|
|
if (process.env.RENOVATE_X_HARD_EXIT) {
|
|
process.exit(process.exitCode);
|
|
}
|
|
})();
|