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
@@ -154,7 +154,7 @@ export const judge = async (ctx: Context) => {
|
||||
if (['default', 'strict'].includes(ctx.config.checker_type || 'default')) {
|
||||
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) {
|
||||
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);
|
||||
})(),
|
||||
(() => {
|
||||
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) {
|
||||
copyIn[parseFilename(file)] = { src: file };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user