core: 修复hydrooj addon运行完成后不会自行退出的问题

This commit is contained in:
undefined committed 2021-02-22 00:41:00 +08:00
1 parent 3f78c35359
commit f9aef434cb
4 files changed
+24 -8

No files matched your search

+2 -1
View File
@@ -5,9 +5,9 @@ const path = require('path');
const cluster = require('cluster');
const fs = require('fs-extra');
const { argv } = require('yargs');
const hydro = require('../dist/loader');
if (!cluster.isMaster) {
const hydro = require('../dist/loader');
// Forked by hydro
hydro.load().catch((e) => {
console.error(e);
@@ -46,6 +46,7 @@ if (!cluster.isMaster) {
fs.writeFileSync(addonPath, JSON.stringify(addons, null, 2));
}
} else {
const hydro = require('../dist/loader');
addons = Array.from(new Set(addons));
for (const addon of addons) hydro.addon(addon);
(argv._[0] === 'cli' ? hydro.loadCli : hydro.load)().catch((e) => {