代码测试截取ERROR_MSG时只在编译错误下截取

This commit is contained in:
yuanke 2016-05-15 00:00:16 +08:00
parent 6056505f96
commit e24470db4c
1 changed files with 3 additions and 1 deletions

View File

@ -123,7 +123,9 @@ class StudentWorkController < ApplicationController
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
resultObj[:status] = -1
resultObj[:results] = result["results"].first #本次测试结果
if result["status"].to_i == -2 #编译错误
result["error_msg"] = result["error_msg"][0..2047]
end
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
#该状态用于存入CodeTests