fix(executor/local): check processState nil
All checks were successful
submodules sync / sync (push) Successful in 44s
build / build (push) Successful in 2m1s
build / trigger-build-image (push) Successful in 11s

This commit is contained in:
张泊明518370910136 2025-03-21 02:53:16 -04:00
parent a53cb6451e
commit 14961db8f0
GPG Key ID: D47306D7062CDA9D

View File

@ -24,10 +24,15 @@ func (e *Local) generateResult(
) stage.ExecutorResult { ) stage.ExecutorResult {
result := stage.ExecutorResult{ result := stage.ExecutorResult{
Status: stage.StatusAccepted, Status: stage.StatusAccepted,
ExitStatus: processState.ExitCode(), ExitStatus: func() int {
if processState == nil {
return -1
}
return processState.ExitCode()
}(),
Error: "", Error: "",
Time: func() uint64 { Time: func() uint64 {
if isTimeout { if processState == nil {
return 0 return 0
} }
nanos := processState.UserTime().Nanoseconds() nanos := processState.UserTime().Nanoseconds()
@ -37,6 +42,9 @@ func (e *Local) generateResult(
return uint64(nanos) return uint64(nanos)
}(), }(),
Memory: func() uint64 { Memory: func() uint64 {
if processState == nil {
return 0
}
usage := processState.SysUsage() usage := processState.SysUsage()
rusage, ok := usage.(*syscall.Rusage) rusage, ok := usage.(*syscall.Rusage)
if !ok { if !ok {