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
20 lines
441 B
Go
20 lines
441 B
Go
//go:build windows
|
|
|
|
package proc
|
|
|
|
// GetCmdline returns a best-effort identifier for a PID using the exe
|
|
// basename from the ToolHelp32 snapshot. Used as a fallback in multi-match
|
|
// output when ReadProcess itself failed.
|
|
func GetCmdline(pid int) string {
|
|
procs, err := enumerateProcesses()
|
|
if err != nil {
|
|
return "(unknown)"
|
|
}
|
|
for _, p := range procs {
|
|
if p.PID == pid && p.Exe != "" {
|
|
return p.Exe
|
|
}
|
|
}
|
|
return "(unknown)"
|
|
}
|