[util.go] It is better to see in a cmdline, rather than in comm.
For example, matrix synapse in comm has just python3. So lets look in both comm and cmdline.
This commit is contained in:
parent
16a60ae504
commit
cf300b899a
12
util.go
12
util.go
@ -18,7 +18,17 @@ func GetProcessPIDs(name string) ([]int, error) {
|
||||
for _, entry := range dir {
|
||||
pid, err := strconv.Atoi(entry.Name())
|
||||
if entry.IsDir() && err == nil {
|
||||
f, err := os.ReadFile("/proc/" + entry.Name() + "/cmdline")
|
||||
f, err := os.ReadFile("/proc/" + entry.Name() + "/comm")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if strings.Contains(string(f[:len(f)-1]), name) {
|
||||
pids = append(pids, pid)
|
||||
continue
|
||||
}
|
||||
|
||||
f, err = os.ReadFile("/proc/" + entry.Name() + "/cmdline")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user