diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 2691d68db..603ce1993 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/hydrojudge", - "version": "2.0.11", + "version": "2.0.12", "main": "package.json", "author": "masnn", "os": [ diff --git a/packages/hydrojudge/src/judge/default.ts b/packages/hydrojudge/src/judge/default.ts index 70cdd881a..95cd97f3e 100644 --- a/packages/hydrojudge/src/judge/default.ts +++ b/packages/hydrojudge/src/judge/default.ts @@ -1,6 +1,7 @@ import Queue from 'p-queue'; import path from 'path'; import fs from 'fs-extra'; +import { argv } from 'yargs'; import { STATUS } from 'hydrooj/dist/model/builtin'; import { CompileError } from '../error'; import { copyInDir, parseFilename } from '../utils'; @@ -10,7 +11,7 @@ import signals from '../signals'; import { check, compileChecker } from '../check'; const Score = { - sum: (a, b) => (a + b), + sum: (a: number, b: number) => (a + b), max: Math.max, min: Math.min, }; @@ -144,7 +145,7 @@ export const judge = async (ctx) => { for (const sid in ctx.config.subtasks) tasks.push(judgeSubtask(ctx.config.subtasks[sid])(ctx)); await Promise.all(tasks); ctx.stat.done = new Date(); - ctx.next({ message: JSON.stringify(ctx.stat) }); + if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) }); ctx.end({ status: ctx.total_status, score: ctx.total_score, diff --git a/packages/hydrojudge/src/judge/run.ts b/packages/hydrojudge/src/judge/run.ts index dd69236ed..886e14d84 100644 --- a/packages/hydrojudge/src/judge/run.ts +++ b/packages/hydrojudge/src/judge/run.ts @@ -1,5 +1,6 @@ import fs from 'fs-extra'; import path from 'path'; +import { argv } from 'yargs'; import { STATUS } from 'hydrooj/dist/model/builtin'; import { run } from '../sandbox'; import compile from '../compile'; @@ -52,7 +53,7 @@ export const judge = async (ctx) => { }, }); ctx.stat.done = new Date(); - ctx.next({ message: JSON.stringify(ctx.stat) }); + if (argv.debug) ctx.next({ message: JSON.stringify(ctx.stat) }); ctx.end({ status, score: status === STATUS.STATUS_ACCEPTED ? 100 : 0, diff --git a/packages/hydrojudge/src/utils.ts b/packages/hydrojudge/src/utils.ts index bf183d167..45d647aed 100644 --- a/packages/hydrojudge/src/utils.ts +++ b/packages/hydrojudge/src/utils.ts @@ -81,7 +81,6 @@ export function compilerText(stdout: string, stderr: string) { const ret = []; if (!EMPTY_STR.test(stdout)) ret.push(stdout); if (!EMPTY_STR.test(stderr)) ret.push(stderr); - ret.push('自豪的采用 HydroJudge 进行评测(github.com/hydro-dev/HydroJudge)'); return ret.join('\n'); }