diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index c2f6462d..0c404d8a 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,9 +1,10 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.1.11", + "version": "2.1.12", "main": "package.json", "author": "masnn", + "repository": "https://github.com/hydro-dev/Hydro.git", "dependencies": { "axios": "^0.21.0", "bson": "^4.1.0", diff --git a/packages/hydrojudge/src/check.ts b/packages/hydrojudge/src/check.ts index 00482b85..4c67e1f0 100644 --- a/packages/hydrojudge/src/check.ts +++ b/packages/hydrojudge/src/check.ts @@ -22,7 +22,7 @@ export async function check(config): Promise<[number, number, string]> { } export async function compileChecker(checkerType: string, checker: string, copyIn: any) { - if (!checkers[checkerType]) { throw new SystemError(`未知比较器类型:${checkerType}`); } + if (!checkers[checkerType]) throw new SystemError(`未知比较器类型:${checkerType}`); const file = await fs.readFile(checker); // TODO cache compiled checker return await compile(parseFilename(checker).split('.')[1], file.toString(), 'checker', copyIn); diff --git a/packages/hydrojudge/src/judge/default.ts b/packages/hydrojudge/src/judge/default.ts index 3d785642..e06487a4 100644 --- a/packages/hydrojudge/src/judge/default.ts +++ b/packages/hydrojudge/src/judge/default.ts @@ -123,7 +123,9 @@ export const judge = async (ctx) => { return await compile(ctx.lang, ctx.code, 'code', copyIn, ctx.next); })(), (async () => { - if (!ctx.config.checker_type || ctx.config.checker_type === 'default') return null; + if (!ctx.config.checker_type || ctx.config.checker_type === 'default') { + return { execute: '', copyIn: {}, clean: Promise.resolve }; + } const copyIn = {}; for (const file of ctx.config.judge_extra_files) { copyIn[parseFilename(file)] = { src: file }; @@ -135,8 +137,7 @@ export const judge = async (ctx) => { ); })(), ]); - if (ctx.checker) ctx.clean.push(ctx.checker.clean); - ctx.clean.push(ctx.execute.clean); + ctx.clean.push(ctx.execute.clean, ctx.checker.clean); ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 }); const tasks = []; ctx.total_status = 0;