更换判题为新的 judger
This commit is contained in:
@@ -7,11 +7,11 @@ from logger import logger
|
||||
from settings import judger_workspace
|
||||
|
||||
|
||||
def compile_(language_item, src_path, exe_path):
|
||||
def compile_(language_item, src_path, exe_path, judge_base_path):
|
||||
compile_command = language_item["compile_command"].format(src_path=src_path, exe_path=exe_path).split(" ")
|
||||
compiler = compile_command[0]
|
||||
compile_args = compile_command[1:]
|
||||
compiler_output_file = os.path.join(judger_workspace, str(time.time()) + ".out")
|
||||
compiler_output_file = os.path.join(judge_base_path, "compiler.out")
|
||||
|
||||
compile_result = judger.run(path=compiler,
|
||||
in_file="/dev/null",
|
||||
@@ -25,13 +25,12 @@ def compile_(language_item, src_path, exe_path):
|
||||
compile_output_handler = open(compiler_output_file)
|
||||
compile_output = compile_output_handler.read()
|
||||
compile_output_handler.close()
|
||||
os.remove(compiler_output_file)
|
||||
|
||||
if compile_result["flag"] != 0:
|
||||
logger.error("Compiler error")
|
||||
logger.error(compile_output)
|
||||
logger.error(str(compile_result))
|
||||
raise CompileError("Compile error")
|
||||
raise CompileError("Compile error, info: " + str(compile_result))
|
||||
else:
|
||||
if "error" in compile_output:
|
||||
raise CompileError(compile_output)
|
||||
|
||||
Reference in New Issue
Block a user