From 14961db8f087a12492401242aa8e046388a553c5 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Fri, 21 Mar 2025 02:53:16 -0400 Subject: [PATCH] fix(executor/local): check processState nil --- internal/executor/local/executor.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/executor/local/executor.go b/internal/executor/local/executor.go index f33d2a7..8f47796 100644 --- a/internal/executor/local/executor.go +++ b/internal/executor/local/executor.go @@ -23,11 +23,16 @@ func (e *Local) generateResult( isTimeout bool, ) stage.ExecutorResult { result := stage.ExecutorResult{ - Status: stage.StatusAccepted, - ExitStatus: processState.ExitCode(), - Error: "", + Status: stage.StatusAccepted, + ExitStatus: func() int { + if processState == nil { + return -1 + } + return processState.ExitCode() + }(), + Error: "", Time: func() uint64 { - if isTimeout { + if processState == nil { return 0 } nanos := processState.UserTime().Nanoseconds() @@ -37,6 +42,9 @@ func (e *Local) generateResult( return uint64(nanos) }(), Memory: func() uint64 { + if processState == nil { + return 0 + } usage := processState.SysUsage() rusage, ok := usage.(*syscall.Rusage) if !ok {