OnlineJudge/judge/compiler.py
virusdefender ef88a8a155 修改部分常量定义
增加编译功能
2015-07-07 13:33:38 +08:00

15 lines
341 B
Python

# coding=utf-8
import commands
class CompileError(Exception):
pass
def compile_(language_item, src_path, exe_path):
command = language_item["compile_command"].format(src_path=src_path, exe_path=exe_path)
status, output = commands.getstatusoutput(command)
if status:
raise CompileError(output)
return exe_path