mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: 更改解释型语言编译阶段写入位置
This commit is contained in:
1 parent
1b96301eef
commit
71ebb3ffd6
2 files changed
+7
-7
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.8.9",
|
"version": "2.8.10",
|
||||||
"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",
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ export = async function compile(
|
|||||||
lang: LangConfig, code: string, target: string, copyIn: any = {}, next?: Function,
|
lang: LangConfig, code: string, target: string, copyIn: any = {}, next?: Function,
|
||||||
): Promise<Execute> {
|
): Promise<Execute> {
|
||||||
target = lang.target || target;
|
target = lang.target || target;
|
||||||
const f = {};
|
copyIn[lang.code_file] = { content: code };
|
||||||
if (lang.compile) {
|
if (lang.compile) {
|
||||||
copyIn[lang.code_file] = { content: code };
|
|
||||||
const {
|
const {
|
||||||
status, stdout, stderr, fileIds,
|
status, stdout, stderr, fileIds,
|
||||||
} = await run(
|
} = await run(
|
||||||
@@ -21,13 +20,14 @@ export = async function compile(
|
|||||||
if (status !== STATUS.STATUS_ACCEPTED) throw new CompileError({ status, stdout, stderr });
|
if (status !== STATUS.STATUS_ACCEPTED) throw new CompileError({ status, stdout, stderr });
|
||||||
if (!fileIds[target]) throw new CompileError({ stderr: 'Executable file not found.' });
|
if (!fileIds[target]) throw new CompileError({ stderr: 'Executable file not found.' });
|
||||||
if (next) next({ compiler_text: compilerText(stdout, stderr) });
|
if (next) next({ compiler_text: compilerText(stdout, stderr) });
|
||||||
f[target] = { fileId: fileIds[target] };
|
|
||||||
return {
|
return {
|
||||||
execute: lang.execute, copyIn: { ...copyIn, ...f }, clean: () => del(fileIds[target]), time: lang.time_limit_rate || 1,
|
execute: lang.execute,
|
||||||
|
copyIn: { ...copyIn, [target]: { fileId: fileIds[target] } },
|
||||||
|
clean: () => del(fileIds[target]),
|
||||||
|
time: lang.time_limit_rate || 1,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
f[target] = { content: code };
|
|
||||||
return {
|
return {
|
||||||
execute: lang.execute, copyIn: { ...copyIn, ...f }, clean: () => Promise.resolve(null), time: lang.time_limit_rate || 1,
|
execute: lang.execute, copyIn, clean: () => Promise.resolve(null), time: lang.time_limit_rate || 1,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user