diff --git a/std-script/judge b/std-script/judge --- a/std-script/judge +++ b/std-script/judge @@ -53,12 +53,13 @@ end language = ARGV[0] -if language != "c" && language != "c++" && language != "pas" +if language != "c" && language != "c++" && language != "pas" && language != "java" && language != "ruby" && language != "python" && language != "php" log "You specified a language that is not supported: #{language}." exit(127) end source_file = ARGV[1] +ENV['SOURCE_NAME'] = source_file if File.exist?(source_file) == false log "The source file does not exist." exit(127) @@ -110,6 +111,8 @@ else call_and_log("Cannot move the compiled program to #{test_result_dir}") { FileUtils.mv("a.out",test_result_dir) + if language == "java" then Dir["*.class"].each { |file| FileUtils.mv(file,test_result_dir)} end + if language == "python" then Dir["*.pyc"].each { |file| FileUtils.mv(file,test_result_dir)} end } FileUtils.rm_rf("#{sandbox_dir}/.") end @@ -133,10 +136,12 @@ call_and_log("Cannot copy the compiled program into #{sandbox_dir}") { FileUtils.cp("#{test_result_dir}/a.out", sandbox_dir, :preserve => true) + if language == "java" then Dir["#{test_result_dir}/*.class"].each { |file| FileUtils.cp(file,sandbox_dir)} end + if language == "python" then Dir["#{test_result_dir}/*.pyc"].each { |file| FileUtils.cp(file,sandbox_dir)} end } begin - execute("#{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script") + execute("#{problem_home}/script/run #{language} #{test_num} ", "Error occured during execution of the run script") rescue # do nothing end