judge: 修复多个测试点间copyIn冲突

pull/21/head
undefined 4 years ago
parent 421f879b36
commit bff5c08101

@ -1,7 +1,7 @@
{
"name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js",
"version": "2.1.24",
"version": "2.1.25",
"main": "package.json",
"author": "masnn",
"repository": "https://github.com/hydro-dev/Hydro.git",

@ -19,7 +19,7 @@ const Score = {
function judgeCase(c) {
return async (ctx, ctxSubtask) => {
const { filename } = ctx.config;
const { copyIn } = ctx.execute;
const copyIn = { ...ctx.execute.copyIn };
if (filename) copyIn[`${filename}.in`] = { src: c.input };
const copyOut = filename ? [`${filename}.out`] : [];
const stdin = filename ? null : c.input;
@ -144,7 +144,7 @@ export const judge = async (ctx) => {
ctx.total_memory_usage_kb = 0;
ctx.total_time_usage_ms = 0;
// sandbox seems cannot handle concurrent tasks with output file correctly
ctx.queue = new Queue({ concurrency: ctx.config.concurrency || (ctx.config.filename ? 1 : 2) });
ctx.queue = new Queue({ concurrency: ctx.config.concurrency || 2 });
for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx));
await Promise.all(tasks);
ctx.stat.done = new Date();

@ -12,7 +12,7 @@ export const judge = async (ctx) => {
ctx.execute = await compile(ctx.lang, ctx.code, 'code', {}, ctx.next);
ctx.clean.push(ctx.execute.clean);
ctx.next({ status: STATUS.STATUS_JUDGING, progress: 0 });
const { copyIn } = ctx.execute;
const copyIn = { ...ctx.execute.copyIn };
const stdin = path.resolve(ctx.tmpdir, 'stdin');
const stdout = path.resolve(ctx.tmpdir, 'stdout');
const stderr = path.resolve(ctx.tmpdir, 'stderr');

Loading…
Cancel
Save