编译器使用绝对路径,否则报找不到文件的异常。

This commit is contained in:
virusdefender 2016-02-01 22:45:13 +08:00
parent 65c2033120
commit ee35981fcb
2 changed files with 5 additions and 6 deletions

View File

@ -2,7 +2,6 @@
import time
import os
import judger
import commands
from judge_exceptions import CompileError, JudgeClientError
from logger import logger
from settings import judger_workspace
@ -14,11 +13,11 @@ def compile_(language_item, src_path, exe_path):
compile_args = compile_command[1:]
compiler_output_file = os.path.join(judger_workspace, str(time.time()) + ".out")
compile_result = judger.run(exe_path=compiler,
compile_result = judger.run(path=compiler,
in_file="/dev/null",
out_file=compiler_output_file,
max_cpu_time=2000,
max_memory=200000000,
max_memory=2000000000,
args=compile_args,
env=["PATH=" + os.environ["PATH"]],
use_sandbox=False)

View File

@ -7,7 +7,7 @@ languages = {
"src_name": "main.c",
"code": 1,
"syscalls": "!execve:k,flock:k,ptrace:k,sync:k,fdatasync:k,fsync:k,msync,sync_file_range:k,syncfs:k,unshare:k,setns:k,clone:k,query_module:k,sysinfo:k,syslog:k,sysfs:k",
"compile_command": "gcc -DONLINE_JUDGE -O2 -w -std=c99 {src_path} -lm -o {exe_path}/main",
"compile_command": "/usr/bin/gcc -DONLINE_JUDGE -O2 -w -std=c99 {src_path} -lm -o {exe_path}/main",
"execute_command": "{exe_path}/main"
},
2: {
@ -15,7 +15,7 @@ languages = {
"src_name": "main.cpp",
"code": 2,
"syscalls": "!execve:k,flock:k,ptrace:k,sync:k,fdatasync:k,fsync:k,msync,sync_file_range:k,syncfs:k,unshare:k,setns:k,clone:k,query_module:k,sysinfo:k,syslog:k,sysfs:k",
"compile_command": "g++ -DONLINE_JUDGE -O2 -w -std=c++11 {src_path} -lm -o {exe_path}/main",
"compile_command": "/usr/bin/g++ -DONLINE_JUDGE -O2 -w -std=c++11 {src_path} -lm -o {exe_path}/main",
"execute_command": "{exe_path}/main"
},
3: {
@ -23,7 +23,7 @@ languages = {
"src_name": "Main.java",
"code": 3,
"syscalls": "!execve:k,flock:k,ptrace:k,sync:k,fdatasync:k,fsync:k,msync,sync_file_range:k,syncfs:k,unshare:k,setns:k,clone[a&268435456==268435456]:k,query_module:k,sysinfo:k,syslog:k,sysfs:k",
"compile_command": "javac {src_path} -d {exe_path}",
"compile_command": "/usr/bin/javac {src_path} -d {exe_path}",
"execute_command": "java -cp {exe_path} -Djava.security.manager -Djava.security.policy==policy Main"
}
}