Files
wehub-resource-sync 36b3af2e3d
PR Check / Code Quality: Format (push) Failing after 1s
PR Check / Code Quality: Lint (darwin) (push) Failing after 0s
PR Check / Code Quality: Lint (freebsd) (push) Failing after 1s
PR Check / Code Quality: Lint (windows) (push) Failing after 1s
PR Check / Code Quality: Lint (linux) (push) Failing after 1s
PR Check / Security: Vulnerability Scan (push) Failing after 0s
Update Documentation / update-docs (push) Failing after 2s
PR Check / Code Quality: Vendor (push) Failing after 1s
PR Check / Code Quality: Coverage (push) Failing after 0s
PR Check / Tests: Unit (macos-latest) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04) (push) Has been cancelled
PR Check / Tests: Unit (ubuntu-24.04-arm) (push) Has been cancelled
PR Check / Tests: Unit (windows-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:22:06 +08:00

34 lines
593 B
Go

//go:build darwin
package proc
import (
"os/user"
"strconv"
)
func readUser(pid int) string {
// On macOS, we get the UID from ps in ReadProcess and resolve it here
// This function is a fallback that just returns unknown
return "unknown"
}
func readUserByUID(uid int) string {
return resolveUID(uid)
}
func resolveUID(uid int) string {
if uid == 0 {
return "root"
}
// Try to resolve username using os/user package (works on macOS)
u, err := user.LookupId(strconv.Itoa(uid))
if err == nil {
return u.Username
}
// Fallback to UID as string
return strconv.Itoa(uid)
}