Skip to content

Commit dc56911

Browse files
authored
fix(unlock cmd): ignore process if its the current id (#360)
1 parent edb3ba3 commit dc56911

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/unlock.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cmd
33
import (
44
"bytes"
55
"fmt"
6+
"os"
67
"os/exec"
78
"strings"
89

@@ -61,9 +62,10 @@ func isAutoresticRunning() bool {
6162

6263
lines := strings.Split(out.String(), "\n")
6364
autoresticProcesses := []string{}
65+
currentPid := fmt.Sprint(os.Getpid())
6466

6567
for _, line := range lines {
66-
if strings.Contains(line, "autorestic") && !strings.Contains(line, "grep autorestic") {
68+
if strings.Contains(line, "autorestic") && !strings.Contains(line, "grep autorestic") && !strings.Contains(line, currentPid) {
6769
autoresticProcesses = append(autoresticProcesses, line)
6870
}
6971
}

0 commit comments

Comments
 (0)