judge: fix

This commit is contained in:
undefined committed 2021-05-10 13:44:36 +08:00
1 parent 05ea014b79
commit 6b5f91d155
3 files changed
+4 -3

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@hydrooj/hydrojudge", "name": "@hydrooj/hydrojudge",
"bin": "bin/hydrojudge.js", "bin": "bin/hydrojudge.js",
"version": "2.6.1", "version": "2.6.2",
"main": "package.json", "main": "package.json",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"repository": "https://github.com/hydro-dev/Hydro.git", "repository": "https://github.com/hydro-dev/Hydro.git",
+2 -2
View File
@@ -178,7 +178,7 @@ async function readAutoCases(folder, { next }, cfg, rst) {
Object.assign(config, result); Object.assign(config, result);
next({ message: { message: 'Found {0} testcases.', params: [config.count] } }); next({ message: { message: 'Found {0} testcases.', params: [config.count] } });
} catch (e) { } catch (e) {
throw new SystemError('Cannot parse testdata.', [e]); throw new SystemError('Cannot parse testdata.', [e.message, ...e.params]);
} }
return config; return config;
} }
@@ -220,7 +220,7 @@ export default async function readCases(folder: string, cfg: Record<string, any>
} }
let auto = !result.outputs?.length; let auto = !result.outputs?.length;
if (auto) { if (auto) {
if (result.subtasks.length && !Math.sum(result.subtasks.map((subtask) => subtask.cases.length))) { if (result.subtasks.length && Math.sum(result.subtasks.map((subtask) => subtask.cases.length))) {
auto = false; auto = false;
} }
} }
+1
View File
@@ -72,6 +72,7 @@ export function restrictFile(p: string) {
export function ensureFile(folder: string) { export function ensureFile(folder: string) {
return (file: string, message: string) => { return (file: string, message: string) => {
if (file === '/dev/null') return file;
// Historical issue // Historical issue
if (file.includes('/')) { if (file.includes('/')) {
const f = path.join(folder, restrictFile(file.split('/')[1])); const f = path.join(folder, restrictFile(file.split('/')[1]));