From 213e4e179e46a33e4ab131602917105dd651b7d0 Mon Sep 17 00:00:00 2001 From: dhwei Date: Thu, 18 Apr 2024 16:14:24 +0800 Subject: [PATCH 1/2] fix index out of range when parsing empty env --- config/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/config.go b/config/config.go index 9071ce93..911ffb46 100644 --- a/config/config.go +++ b/config/config.go @@ -346,6 +346,11 @@ func parseEnv(s string) *map[string]string { for i = start; i < n && s[i] != '='; { i++ } + + if start >= n || i+1 >= n { + break + } + key := s[start:i] start = i + 1 if s[start] == '"' { From 0c4f0cd8900f3cf2adbb110f8e8a1355bd873181 Mon Sep 17 00:00:00 2001 From: dhwei Date: Thu, 18 Apr 2024 16:16:10 +0800 Subject: [PATCH 2/2] remove zero stopTime display --- process/process.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/process/process.go b/process/process.go index 62ded352..9b995625 100644 --- a/process/process.go +++ b/process/process.go @@ -224,7 +224,9 @@ func (p *Process) GetDescription() string { } return fmt.Sprintf("pid %d, uptime %d:%02d:%02d", p.cmd.Process.Pid, hours%24, minutes%60, seconds%60) } else if p.state != Stopped { - return p.stopTime.String() + if p.stopTime.Unix() > 0 { + return p.stopTime.String() + } } return "" }