From 5cd5343c819a083d51f0c67787096d4c5c7d8397 Mon Sep 17 00:00:00 2001 From: rwxd Date: Tue, 12 Mar 2024 18:49:27 +0100 Subject: [PATCH] fix(unlock cmd): ignore process if its the current id --- cmd/unlock.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/unlock.go b/cmd/unlock.go index cc109ae..75aabf5 100644 --- a/cmd/unlock.go +++ b/cmd/unlock.go @@ -3,6 +3,7 @@ package cmd import ( "bytes" "fmt" + "os" "os/exec" "strings" @@ -61,9 +62,10 @@ func isAutoresticRunning() bool { lines := strings.Split(out.String(), "\n") autoresticProcesses := []string{} + currentPid := fmt.Sprint(os.Getpid()) for _, line := range lines { - if strings.Contains(line, "autorestic") && !strings.Contains(line, "grep autorestic") { + if strings.Contains(line, "autorestic") && !strings.Contains(line, "grep autorestic") && !strings.Contains(line, currentPid) { autoresticProcesses = append(autoresticProcesses, line) } }