core: add ui

This commit is contained in:
undefined committed 2020-12-20 00:09:26 +08:00
1 parent 558fe34db1
commit 2cbf05dfe3
12 files changed
+168 -204

No files matched your search

+4 -4
View File
@@ -18,8 +18,8 @@ export const builtinLib = [
export const builtinModel = [
'builtin', 'document', 'domain', 'blacklist', 'opcount',
'setting', 'token', 'user', 'problem', 'record',
'contest', 'message', 'solution', 'training', 'file',
'discussion', 'system', 'oplog',
'contest', 'message', 'solution', 'training', 'oplog',
'discussion', 'system',
];
export const builtinHandler = [
@@ -53,7 +53,7 @@ export async function handler(pending: string[], fail: string[]) {
} catch (e) {
fail.push(i);
logger.error('Handler Load Fail: %s', i);
logger.error('%o', e);
logger.error(e);
}
}
}
@@ -77,7 +77,7 @@ export async function locale(pending: string[], fail: string[]) {
} catch (e) {
fail.push(i);
logger.error('Locale Load Fail: %s', i);
logger.error('%o', e);
logger.error(e);
}
}
}
+4 -7
View File
@@ -3,7 +3,6 @@
import os from 'os';
import path from 'path';
import fs from 'fs-extra';
import pslist from 'ps-list';
import { argv } from 'yargs';
import { builtinModel } from './common';
import { Entry } from '../loader';
@@ -22,13 +21,11 @@ export async function load(call: Entry) {
if (fs.existsSync(lockfile) && !argv.ignorelock) {
try {
const file = require(lockfile);
const plist = await pslist();
if (file.pid && plist.map((i) => i.pid).includes(file.pid)) {
logger.error(`Lockfile exists, pid=${file.pid}`);
process.exit(1);
}
process.kill(file.pid, 0);
logger.error(`Lockfile exists, pid=${file.pid}`);
process.exit(1);
} catch {
// Invalid lockfile. ignore.
// Invalid lockfile or process not exist
}
}
const context = {