mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: add user_code to checker context (#325)
This commit is contained in:
1 parent
1479a00cad
commit
4ce8439e99
3 files changed
+6
-3
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/hydrojudge",
|
"name": "@hydrooj/hydrojudge",
|
||||||
"bin": "bin/hydrojudge.js",
|
"bin": "bin/hydrojudge.js",
|
||||||
"version": "2.14.8",
|
"version": "2.14.9",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ export const judge = async (ctx: Context) => {
|
|||||||
if (['default', 'strict'].includes(ctx.config.checker_type || 'default')) {
|
if (['default', 'strict'].includes(ctx.config.checker_type || 'default')) {
|
||||||
return { execute: '', copyIn: {}, clean: () => Promise.resolve(null) };
|
return { execute: '', copyIn: {}, clean: () => Promise.resolve(null) };
|
||||||
}
|
}
|
||||||
const copyIn = {};
|
const copyIn = { user_code: { content: ctx.code } };
|
||||||
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 };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,10 @@ export const judge = async (ctx: Context) => {
|
|||||||
return compile(ctx.getLang(ctx.lang), ctx.code, copyIn, ctx.next);
|
return compile(ctx.getLang(ctx.lang), ctx.code, copyIn, ctx.next);
|
||||||
})(),
|
})(),
|
||||||
(() => {
|
(() => {
|
||||||
const copyIn = { 'testlib.h': { src: testlibSrc } };
|
const copyIn = {
|
||||||
|
'testlib.h': { src: testlibSrc },
|
||||||
|
user_code: { content: ctx.code },
|
||||||
|
};
|
||||||
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 };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user