core: 修复自测不提供输入数据会进入评测流程的问题

This commit is contained in:
undefined committed 2021-02-05 17:25:17 +08:00
1 parent bb856bacce
commit 33aaf1f2ea
8 files changed
+20 -45

No files matched your search

+4 -3
View File
@@ -29,6 +29,7 @@ class JudgeTask {
lang: string;
code: string;
tmpdir: string;
input?: string;
clean: Function[];
data: any[];
folder: string;
@@ -57,6 +58,7 @@ class JudgeTask {
this.lang = this.request.lang;
this.code = this.request.code;
this.config = this.request.config;
this.input = this.request.input;
this.data = this.request.data;
this.tmpdir = path.resolve(getConfig('tmp_dir'), this.host, this.rid);
this.clean = [];
@@ -64,9 +66,8 @@ class JudgeTask {
tmpfs.mount(this.tmpdir, '512m');
log.info('Submission: %s/%s/%s pid=%s', this.host, this.domainId, this.rid, this.pid);
try {
if (this.type === 'judge') await this.doSubmission();
else if (this.type === 1) await this.doPretest();
else throw new SystemError(`Unsupported type: ${this.type}`);
if (this.input) await this.doPretest();
else await this.doSubmission();
} catch (e) {
if (e instanceof CompileError) {
this.next({ compiler_text: compilerText(e.stdout, e.stderr) });