mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-05 13:28:08 +03:00
fix: refactor process.exit(1) calls to run after logger flushes
https://stackoverflow.com/questions/18771707/how-to-flush-winston-logs
This commit is contained in:
@@ -67,15 +67,21 @@ if (require.main === module) {
|
||||
ValidateCollection(options.collection as Databases)
|
||||
.then(() => process.exit(0))
|
||||
.catch((err: unknown) => {
|
||||
logger.error(`Failed to validate collection ${options.collection}?`, { err });
|
||||
process.exit(1);
|
||||
logger.error(
|
||||
`Failed to validate collection ${options.collection}?`,
|
||||
{ err },
|
||||
() => {
|
||||
process.exit(1);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
ValidateAllCollections()
|
||||
.then(() => process.exit(0))
|
||||
.catch((err: unknown) => {
|
||||
logger.error(`Failed to validate all collections?`, { err });
|
||||
process.exit(1);
|
||||
logger.error(`Failed to validate all collections?`, { err }, () => {
|
||||
process.exit(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user