From dc56911a456dd2fc4beb35c88cdb92e66e4f86cb Mon Sep 17 00:00:00 2001 From: Florian <40308458+rwxd@users.noreply.github.com> Date: Wed, 13 Mar 2024 12:39:51 +0100 Subject: [PATCH] fix(unlock cmd): ignore process if its the current id (#360) --- 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) } }