From a361e420aae32bd427dd2e4d86092ccff64834ca Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 8 Jun 2025 19:46:51 +0800 Subject: [PATCH] judge: compilerText: allow multiple files --- packages/hydrojudge/src/utils.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/hydrojudge/src/utils.ts b/packages/hydrojudge/src/utils.ts index d8e659a3d..f8a5fc310 100644 --- a/packages/hydrojudge/src/utils.ts +++ b/packages/hydrojudge/src/utils.ts @@ -27,11 +27,8 @@ export namespace Lock { } } -export function compilerText(stdout: string, stderr: string) { - const ret = []; - if (!EMPTY_STR.test(stdout)) ret.push(stdout.substring(0, 1024 * 1024)); - if (!EMPTY_STR.test(stderr)) ret.push(stderr.substring(0, 1024 * 1024)); - return ret.join('\n'); +export function compilerText(...messages: string[]) { + return messages.filter((i) => !EMPTY_STR.test(i)).map((i) => i.substring(0, 1024 * 1024)).join('\n'); } function restrictFile(p: string) {