diff --git a/worker/runner.go b/worker/runner.go index c65a1d6..742764f 100644 --- a/worker/runner.go +++ b/worker/runner.go @@ -42,9 +42,6 @@ func (jc *JudgeRunner) Judge(sub types.Submission, ctx context.Context, announce return &types.FinalResult{Verdict: types.FinalCompileError, CompilerOutput: compOut} } fv, p, e := jc.Run(rt, sub, announce, outPath, callback, ctx) - if e != nil { - - } return &types.FinalResult{ Verdict: fv, CompilerOutput: compOut, diff --git a/worker/worker.go b/worker/worker.go index ba751d0..77e713a 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -136,13 +136,15 @@ func (w *JudgeWorker) Judge(r *_runner, sub types.Submission) { r.currentSubmission.Store(sub.ID) // TODO: immediately halt runner when getting error judge := r.Judge(sub, r.ctx, func(caseId uint16) bool { - return prod.Report(types.ResultAnnouncement, caseId) != nil + return prod.Report(types.ResultAnnouncement, caseId) == nil }, func(r types.CaseResult) bool { return prod.Report(types.ResultCase, r) == nil }) finalResult := judge() - // replace actual new line characters with \\n to avoid shattered payloads when serializing response with msgpack - finalResult.CompilerOutput = strings.ReplaceAll(finalResult.CompilerOutput, "\n", "\\n") + if finalResult != nil { + // replace actual new line characters with \\n to avoid shattered payloads when serializing response with msgpack + finalResult.CompilerOutput = strings.ReplaceAll(finalResult.CompilerOutput, "\n", "\\n") + } prod.Report(types.ResultFinal, finalResult) }