From 354bb0302ad1ebc7edaf5b9f60c49101e3e8c3f3 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Sat, 12 Sep 2015 17:57:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=93=BE=E6=8E=A5=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E7=9A=84=E8=AD=A6=E5=91=8A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge/judger/compiler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/judge/judger/compiler.py b/judge/judger/compiler.py index 7f40ff1c..ee47ae2a 100644 --- a/judge/judger/compiler.py +++ b/judge/judger/compiler.py @@ -24,11 +24,13 @@ def compile_(language_item, src_path, exe_path): if output_start == -1: raise JudgeClientError("Error running compiler in lrun") - # 返回值不为0 或者 stderr中lrun的输出之前有东西 - if status or output_start: + # 返回值不为 0 或者 stderr 中 lrun 的输出之前有 erro r字符串 + # 判断 error 字符串的原因是链接的时候可能会有一些不推荐使用的函数的的警告, + # 但是 -w 参数并不能关闭链接时的警告 + if status or "error" in output[0:output_start]: raise CompileError(output[0:output_start]) - parse_result = parse_lrun_output(output) + parse_result = parse_lrun_output(output[output_start:]) if parse_result["exit_code"] or parse_result["term_sig"] or parse_result["siginaled"] or parse_result["exceed"]: raise CompileError("Compile error")