From a9082354c8493536d6bdfb71d709ac4eaf1975dd Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 6 Mar 2022 20:44:51 +0800 Subject: [PATCH] judge: enable copyIn in execute stage --- packages/hydrojudge/package.json | 8 ++++---- packages/hydrojudge/src/judge/run.ts | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 9885dda8a..f1696a41b 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,7 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.14.1", + "version": "2.14.2", "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", @@ -10,7 +10,7 @@ "axios": "^0.25.0", "cac": "^6.7.12", "esbuild": "0.14.3", - "fs-extra": "^10.0.0", + "fs-extra": "^10.0.1", "js-yaml": "^4.1.0", "lodash": "^4.17.21", "mongodb": "^3.7.3", @@ -23,9 +23,9 @@ "devDependencies": { "@types/fs-extra": "^9.0.13", "@types/js-yaml": "^4.0.5", - "@types/lodash": "^4.14.178", + "@types/lodash": "^4.14.179", "@types/shell-quote": "^1.7.1", - "@types/ws": "^8.2.2" + "@types/ws": "^8.5.2" }, "peerDependencies": { "hydrooj": "*" diff --git a/packages/hydrojudge/src/judge/run.ts b/packages/hydrojudge/src/judge/run.ts index a0dd84c6a..bc3f1c591 100644 --- a/packages/hydrojudge/src/judge/run.ts +++ b/packages/hydrojudge/src/judge/run.ts @@ -20,7 +20,13 @@ export const judge = async (ctx: Context) => { ctx.stat.judge = new Date(); ctx.next({ status: STATUS.STATUS_COMPILING }); try { - ctx.execute = await compile(ctx.getLang(ctx.lang), ctx.code, {}, ctx.next); + ctx.execute = await compile( + ctx.getLang(ctx.lang), ctx.code, + Object.fromEntries( + (ctx.config.user_extra_files || []).map((i) => [i.split('/').pop(), { src: i }]), + ), + ctx.next, + ); } catch (e) { if (e instanceof CompileError) { ctx.next({