diff --git a/std-script/judge b/std-script/judge --- a/std-script/judge +++ b/std-script/judge @@ -16,9 +16,9 @@ def execute(command, error_message="") if not system(command) - log "ERROR: #{error_message}" - puts "ERROR: #{error_message}" - exit(127) + msg = "ERROR: #{error_message}" + log msg + raise msg end end @@ -105,7 +105,11 @@ (1..(problem.num_tests)).each do |test_num| log "Test number: #{test_num}" execute("cp #{test_result_dir}/a.out #{sandbox_dir}", "Cannot copy the compiled program into #{sandbox_dir}") - execute("#{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script") + begin + execute("#{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script") + rescue + # do nothing + end execute("mkdir #{test_result_dir}/#{test_num}", "Cannot create directory #{test_result_dir}/#{test_num}") execute("mv #{sandbox_dir}/result #{test_result_dir}/#{test_num}", "Cannot copy the result file into #{test_result_dir}/#{test_num}") execute("mv #{sandbox_dir}/comment #{test_result_dir}/#{test_num}", "Cannot copy the comment file into #{test_result_dir}/#{test_num}")