From 046867eb6cbb2eab60be5602c1e324337d312720 Mon Sep 17 00:00:00 2001 From: virusdefender <1670873886@qq.com> Date: Wed, 3 Feb 2016 10:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=AF=91=E9=94=99=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- judge/compiler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/judge/compiler.py b/judge/compiler.py index 42b575ab..f39a62d3 100644 --- a/judge/compiler.py +++ b/judge/compiler.py @@ -23,14 +23,17 @@ def compile_(language_item, src_path, exe_path, judge_base_path): use_sandbox=False) compile_output_handler = open(compiler_output_file) - compile_output = compile_output_handler.read() + compile_output = compile_output_handler.read().strip() compile_output_handler.close() if compile_result["flag"] != 0: logger.error("Compiler error") logger.error(compile_output) logger.error(str(compile_result)) - raise CompileError("Compile error, info: " + str(compile_result)) + if compile_output: + raise CompileError(compile_output) + else: + raise CompileError("Compile error, info: " + str(compile_result)) else: if "error" in compile_output: raise CompileError(compile_output)