Skip to content

Commit

Permalink
Return "-" if command is an empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
ricardobranco777 committed Dec 31, 2024
1 parent a5aa13b commit 558ac78
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion restartable.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func getCommand(fs ProcPidFS, fullPath bool, statusName string) (string, error)
exe = ""
}
exe = strings.TrimSuffix(exe, " (deleted)")
if len(cmdline) > 0 && !strings.HasPrefix(cmdline[0], "/") && exe != "" && filepath.Base(cmdline[0]) == filepath.Base(exe) {
if exe != "" && !strings.HasPrefix(cmdline[0], "/") && filepath.Base(cmdline[0]) == filepath.Base(exe) {
cmdline[0] = exe
}
command = strings.Join(cmdline, " ")
Expand All @@ -187,6 +187,10 @@ func getCommand(fs ProcPidFS, fullPath bool, statusName string) (string, error)
command = strings.Split(command, " ")[0]
}
}

if command == "" {
command = "-"
}
return command, nil
}

Expand Down

0 comments on commit 558ac78

Please sign in to comment.