diff --git a/lib/engine.rb b/lib/engine.rb --- a/lib/engine.rb +++ b/lib/engine.rb @@ -117,7 +117,7 @@ Dir.chdir grading_dir cmd = "#{problem_home}/script/judge #{language} #{fname}" talk "CMD: #{cmd}" - system(cmd) + system("ruby " + cmd) end def get_std_script_dir diff --git a/std-script/compile b/std-script/compile --- a/std-script/compile +++ b/std-script/compile @@ -23,9 +23,9 @@ end end -C_COMPILER = "/usr/bin/gcc" -CPLUSPLUS_COMPILER = "/usr/bin/g++" -PASCAL_COMPILER = "/usr/bin/fpc" +C_COMPILER = "gcc" +CPLUSPLUS_COMPILER = "g++" +PASCAL_COMPILER = "fpc" C_OPTIONS = "-O2 -s -static -std=c99 -DCONTEST -lm -Wall" CPLUSPLUS_OPTIONS = "-O2 -s -static -DCONTEST -lm -Wall" diff --git a/std-script/judge b/std-script/judge --- a/std-script/judge +++ b/std-script/judge @@ -98,9 +98,11 @@ log "ERROR: Cannot change directory to #{sandbox_dir}." exit(127) end -execute("#{problem_home}/script/compile #{language} #{source_file}", "Compilation error!") -compile_message = open("compiler_message").read -compile_message.strip! +execute("ruby #{problem_home}/script/compile #{language} #{source_file}", "Compilation error!") +open("compiler_message") do |f| + compile_message = f.read + compile_message.strip! +end call_and_log("Cannot move the compiler message to #{test_result_dir}.") { FileUtils.mv("compiler_message", test_result_dir) } @@ -134,7 +136,7 @@ FileUtils.cp("#{test_result_dir}/a.out", sandbox_dir) } begin - execute("#{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script") + execute("ruby #{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script") rescue # do nothing end @@ -166,7 +168,7 @@ log "ERROR: Cannot change directory to #{test_result_dir}." exit(127) end -execute("#{problem_home}/script/grade", "An error occured during grading!") +execute("ruby #{problem_home}/script/grade", "An error occured during grading!") log log "All done!" diff --git a/std-script/run b/std-script/run --- a/std-script/run +++ b/std-script/run @@ -73,7 +73,7 @@ #`cp #{problem_home}/test_cases/#{test_num}/#{input_file_name} .` # check if box is there, if not, compile it! -if !File.exists?("#{problem_home}/script/box") +if !File.exists?("#{problem_home}/script/box") and !File.exists?("#{problem_home}/script/box.exe") log "WARNING: Compiling box: to increase efficiency, it should be compile manually" compile_box("#{problem_home}/script/box.cc", "#{problem_home}/script/box") @@ -145,7 +145,7 @@ check_command = "#{problem_home}/script/check #{language} #{test_num}" log "Checking the output..." log check_command -if not system(check_command) +if not system("ruby " + check_command) log "Problem with check script" report.call("Incorrect",0,"Check script error.\n") exit(127)