Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Dec 30, 2024
1 parent 9fbb93f commit 132099d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions restartable.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,21 @@ func GetDeleted(fs ProcPidFS) ([]string, error) {

// GetService retrieves the service name
func GetService(fs ProcPidFS, userService bool) string {
cgroup, err := fs.ReadFile("cgroup")
data, err := fs.ReadFile("cgroup")
if err != nil {
return "-"
}
cgroup := strings.TrimSpace(string(data))

var match []string
if pid1 == "systemd" {
if userService {
match = regexUserService.FindStringSubmatch(strings.TrimSpace(string(cgroup)))
match = regexUserService.FindStringSubmatch(cgroup)
} else {
match = regexSystemService.FindStringSubmatch(strings.TrimSpace(string(cgroup)))
match = regexSystemService.FindStringSubmatch(cgroup)
}
} else if pid1 == "openrc" {
match = regexOpenRC.FindStringSubmatch(strings.TrimSpace(string(cgroup)))
match = regexOpenRC.FindStringSubmatch(cgroup)
}

if len(match) > 1 {
Expand Down

0 comments on commit 132099d

Please sign in to comment.