mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: fix copyIn
This commit is contained in:
1 parent
51a6b8b9c4
commit
4798153ce9
3 files changed
+7
-5
No files matched your search
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.1.11",
|
"version": "2.1.12",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "masnn",
|
"author": "masnn",
|
||||||
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.21.0",
|
"axios": "^0.21.0",
|
||||||
"bson": "^4.1.0",
|
"bson": "^4.1.0",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export async function check(config): Promise<[number, number, string]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function compileChecker(checkerType: string, checker: string, copyIn: any) {
|
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);
|
const file = await fs.readFile(checker);
|
||||||
// TODO cache compiled checker
|
// TODO cache compiled checker
|
||||||
return await compile(parseFilename(checker).split('.')[1], file.toString(), 'checker', copyIn);
|
return await compile(parseFilename(checker).split('.')[1], file.toString(), 'checker', copyIn);
|
||||||
|
|||||||
@@ -123,7 +123,9 @@ export const judge = async (ctx) => {
|
|||||||
return await compile(ctx.lang, ctx.code, 'code', copyIn, ctx.next);
|
return await compile(ctx.lang, ctx.code, 'code', copyIn, ctx.next);
|
||||||
})(),
|
})(),
|
||||||
(async () => {
|
(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 = {};
|
const copyIn = {};
|
||||||
for (const file of ctx.config.judge_extra_files) {
|
for (const file of ctx.config.judge_extra_files) {
|
||||||
copyIn[parseFilename(file)] = { src: file };
|
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.checker.clean);
|
||||||
ctx.clean.push(ctx.execute.clean);
|
|
||||||
ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 });
|
ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 });
|
||||||
const tasks = [];
|
const tasks = [];
|
||||||
ctx.total_status = 0;
|
ctx.total_status = 0;
|
||||||
|
|||||||
Reference in new issue
Block a user