mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
90291bd627
ppd, and some things. Add a simple wpa_supplicant backend
30 lines
501 B
Go
30 lines
501 B
Go
package matugen
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"strconv"
|
|
"strings"
|
|
"syscall"
|
|
)
|
|
|
|
func signalByName(name string, sig syscall.Signal) {
|
|
entries, err := os.ReadDir("/proc")
|
|
if err != nil {
|
|
return
|
|
}
|
|
for _, entry := range entries {
|
|
pid, err := strconv.Atoi(entry.Name())
|
|
if err != nil {
|
|
continue
|
|
}
|
|
comm, err := os.ReadFile(filepath.Join("/proc", entry.Name(), "comm"))
|
|
if err != nil {
|
|
continue
|
|
}
|
|
if strings.TrimSpace(string(comm)) == name {
|
|
syscall.Kill(pid, sig)
|
|
}
|
|
}
|
|
}
|