From 71ebb3ffd6bad019748a2bc4dab5fc63033f2fef Mon Sep 17 00:00:00 2001 From: undefined Date: Wed, 16 Jun 2021 19:14:36 +0800 Subject: [PATCH] =?UTF-8?q?judge:=20=E6=9B=B4=E6=94=B9=E8=A7=A3=E9=87=8A?= =?UTF-8?q?=E5=9E=8B=E8=AF=AD=E8=A8=80=E7=BC=96=E8=AF=91=E9=98=B6=E6=AE=B5?= =?UTF-8?q?=E5=86=99=E5=85=A5=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hydrojudge/package.json | 2 +- packages/hydrojudge/src/compile.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index e759c152e..ad9686d78 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.8.9", + "version": "2.8.10", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/compile.ts b/packages/hydrojudge/src/compile.ts index 894d0b988..404fb1ca8 100644 --- a/packages/hydrojudge/src/compile.ts +++ b/packages/hydrojudge/src/compile.ts @@ -9,9 +9,8 @@ export = async function compile( lang: LangConfig, code: string, target: string, copyIn: any = {}, next?: Function, ): Promise { target = lang.target || target; - const f = {}; + copyIn[lang.code_file] = { content: code }; if (lang.compile) { - copyIn[lang.code_file] = { content: code }; const { status, stdout, stderr, fileIds, } = await run( @@ -21,13 +20,14 @@ export = async function compile( if (status !== STATUS.STATUS_ACCEPTED) throw new CompileError({ status, stdout, stderr }); if (!fileIds[target]) throw new CompileError({ stderr: 'Executable file not found.' }); if (next) next({ compiler_text: compilerText(stdout, stderr) }); - f[target] = { fileId: fileIds[target] }; 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 { - 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, }; };