diff --git a/packages/hydrojudge/src/judge/default.ts b/packages/hydrojudge/src/judge/default.ts index be4d54bb0..ce33e0e6f 100644 --- a/packages/hydrojudge/src/judge/default.ts +++ b/packages/hydrojudge/src/judge/default.ts @@ -143,7 +143,8 @@ export const judge = async (ctx) => { ctx.total_score = 0; ctx.total_memory_usage_kb = 0; ctx.total_time_usage_ms = 0; - ctx.queue = new Queue({ concurrency: ctx.config.concurrency || 2 }); + // sandbox seems cannot handle concurrent tasks with output file correctly + ctx.queue = new Queue({ concurrency: ctx.config.concurrency || (ctx.config.filename ? 1 : 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(); diff --git a/packages/hydrojudge/src/sandbox.ts b/packages/hydrojudge/src/sandbox.ts index e1a6b0c8e..964a8ea87 100644 --- a/packages/hydrojudge/src/sandbox.ts +++ b/packages/hydrojudge/src/sandbox.ts @@ -104,9 +104,7 @@ export async function run(execute, params?) { else ret.stdout = result.files.stdout || ''; if (params.stderr) await fs.writeFile(params.stderr, result.files.stderr || ''); else ret.stderr = result.files.stderr || ''; - if (result.error) { - ret.error = result.error; - } + if (result.error) ret.error = result.error; ret.files = result.files; ret.fileIds = result.fileIds || {}; return ret;