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

+2 -2
View File
@@ -178,7 +178,7 @@ async function readAutoCases(folder, { next }, cfg, rst) {
Object.assign(config, result);
next({ message: { message: 'Found {0} testcases.', params: [config.count] } });
} catch (e) {
throw new SystemError('Cannot parse testdata.', [e]);
throw new SystemError('Cannot parse testdata.', [e.message, ...e.params]);
}
return config;
}
@@ -220,7 +220,7 @@ export default async function readCases(folder: string, cfg: Record<string, any>
}
let auto = !result.outputs?.length;
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;
}
}
+1
View File
@@ -72,6 +72,7 @@ export function restrictFile(p: string) {
export function ensureFile(folder: string) {
return (file: string, message: string) => {
if (file === '/dev/null') return file;
// Historical issue
if (file.includes('/')) {
const f = path.join(folder, restrictFile(file.split('/')[1]));