ps: use slices.Contains

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2025-03-28 18:50:44 -07:00
parent ef5acfab4f
commit f64edc4d6d
+3 -5
View File
@@ -6,6 +6,7 @@ import (
"fmt"
"os"
"os/exec"
"slices"
"strconv"
"strings"
@@ -86,11 +87,8 @@ var psCommand = cli.Command{
return fmt.Errorf("unable to parse pid: %w", err)
}
for _, pid := range pids {
if pid == p {
fmt.Println(line)
break
}
if slices.Contains(pids, p) {
fmt.Println(line)
}
}
return nil