diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index b1350b455..191b1a1dc 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,7 +1,10 @@ { "name": "@hydrooj/hydrojudge", "bin": "bin/hydrojudge.js", - "version": "2.4.3", + "version": "2.4.4", + "os": [ + "linux" + ], "main": "package.json", "author": "undefined ", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/hydrojudge/src/cases.ts b/packages/hydrojudge/src/cases.ts index 31b4816a1..899f7b867 100644 --- a/packages/hydrojudge/src/cases.ts +++ b/packages/hydrojudge/src/cases.ts @@ -235,8 +235,8 @@ export async function readYamlCases(folder: string, cfg: Dictionary = {}, a for (const c of cfg.cases) { config.count++; config.subtasks[0].cases.push({ - input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : null, - output: c.output ? checkFile(c.output, 'Cannot find output file {0}.') : null, + input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : '/dev/null', + output: c.output ? checkFile(c.output, 'Cannot find output file {0}.') : '/dev/null', id: config.count, }); } @@ -246,8 +246,8 @@ export async function readYamlCases(folder: string, cfg: Dictionary = {}, a for (const c of subtask.cases) { config.count++; cases.push({ - input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : null, - output: c.output ? checkFile(c.output, 'Cannot find output file {0}.') : null, + input: c.input ? checkFile(c.input, 'Cannot find input file {0}.') : '/dev/null', + output: c.output ? checkFile(c.output, 'Cannot find output file {0}.') : '/dev/null', id: config.count, }); } diff --git a/packages/hydrojudge/src/judge/interactive.ts b/packages/hydrojudge/src/judge/interactive.ts index 60f043f9b..d8c11e394 100644 --- a/packages/hydrojudge/src/judge/interactive.ts +++ b/packages/hydrojudge/src/judge/interactive.ts @@ -111,6 +111,7 @@ export const judge = async (ctx) => { ); })(), ]); + ctx.clean.push(ctx.executeUser.clean, ctx.executeInteractor.clean); ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 }); const tasks = []; ctx.total_status = ctx.total_score = ctx.total_memory_usage_kb = ctx.total_time_usage_ms = 0; diff --git a/packages/hydrojudge/src/sandbox.ts b/packages/hydrojudge/src/sandbox.ts index 63c670646..64a2e1674 100644 --- a/packages/hydrojudge/src/sandbox.ts +++ b/packages/hydrojudge/src/sandbox.ts @@ -10,6 +10,7 @@ import { Logger } from './log'; const logger = new Logger('sandbox'); const env = ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'HOME=/w']; const axios = Axios.create({ baseURL: getConfig('sandbox_host') }); +let callId = 0; const statusMap = { 'Time Limit Exceeded': STATUS.STATUS_TIME_LIMIT_EXCEEDED, @@ -90,9 +91,10 @@ export async function runMultiple(execute) { body.cmd[0].files[1] = null; body.cmd[1].files[0] = null; body.cmd[1].files[1] = null; - if (argv['show-sandbox-call']) logger.debug(JSON.stringify(body)); + const id = callId++; + if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body)); res = await axios.post('/run', body); - if (argv['show-sandbox-call']) logger.debug(JSON.stringify(res.data)); + if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data)); } catch (e) { throw new SystemError('Sandbox Error'); } @@ -111,9 +113,10 @@ export async function run(execute, params?) { if (typeof execute === 'object') return await runMultiple(execute); try { const body = { cmd: [proc({ execute, ...params })] }; - if (argv['show-sandbox-call']) logger.debug(JSON.stringify(body)); + const id = callId++; + if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(body)); const res = await axios.post('/run', body); - if (argv['show-sandbox-call']) logger.debug(JSON.stringify(res.data)); + if (argv['show-sandbox-call']) logger.debug('%d %s', id, JSON.stringify(res.data)); [result] = res.data; } catch (e) { // FIXME request body larger than maxBodyLength limit