judge: fix user_extra_files

This commit is contained in:
undefined committed 2021-06-09 09:40:08 +08:00
1 parent a673523b9a
commit de96722d57
4 files changed
+13 -5

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.8.2",
"version": "2.8.3",
"main": "package.json",
"author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git",
+3 -1
View File
@@ -135,7 +135,9 @@ export const judge = async (ctx) => {
for (const file of ctx.config.user_extra_files) {
copyIn[parseFilename(file)] = { src: file };
}
return await compile(ctx.getLang(ctx.lang), ctx.code, 'code', copyIn, ctx.next);
const execute = await compile(ctx.getLang(ctx.lang), ctx.code, 'code', copyIn, ctx.next);
execute.copyIn = { ...copyIn, ...execute.copyIn };
return execute;
})(),
(async () => {
if (!ctx.config.checker_type || ctx.config.checker_type === 'default') {
+6 -2
View File
@@ -25,7 +25,9 @@ export const judge = async (ctx) => {
for (const file of ctx.config.user_extra_files) {
copyIn[parseFilename(file)] = { src: file };
}
return await compile(ctx.getLang(ctx.lang), ctx.code, 'code', copyIn, ctx.next);
const exec = await compile(ctx.getLang(ctx.lang), ctx.code, 'code', copyIn, ctx.next);
exec.copyIn = { ...copyIn, ...exec.copyIn };
return exec;
})(),
// Validator
(async () => {
@@ -43,7 +45,9 @@ export const judge = async (ctx) => {
copyIn[parseFilename(file)] = { src: file };
}
const file = await fs.readFile(ctx.config.std);
return await compile(ctx.getLang(parseFilename(ctx.config.std).split('.')[1]), file.toString(), 'std', copyIn);
const exec = await compile(ctx.getLang(parseFilename(ctx.config.std).split('.')[1]), file.toString(), 'std', copyIn);
exec.copyIn = { ...copyIn, ...exec.copyIn };
return exec;
})(),
// Checker
(async () => {
+3 -1
View File
@@ -97,7 +97,9 @@ export const judge = async (ctx) => {
for (const file of ctx.config.user_extra_files) {
copyIn[parseFilename(file)] = { src: file };
}
return await compile(ctx.getLang(ctx.lang), ctx.code, 'code', copyIn, ctx.next);
const execute = await compile(ctx.getLang(ctx.lang), ctx.code, 'code', copyIn, ctx.next);
execute.copyIn = { ...copyIn, ...execute.copyIn };
return execute;
})(),
(async () => {
const copyIn = { 'testlib.h': { src: testlibSrc } };