(pid int)
| 11 | ) |
| 12 | |
| 13 | func processCommandLine(pid int) (string, error) { |
| 14 | out, err := exec.Command("ps", "-p", strconv.Itoa(pid), "-o", "command=").Output() |
| 15 | if err != nil { |
| 16 | return "", err |
| 17 | } |
| 18 | return strings.TrimSpace(string(out)), nil |
| 19 | } |
| 20 | |
| 21 | // processAlive reports whether a process with the given PID is currently |
| 22 | // running. FindProcess always succeeds on Unix, so liveness is probed with |
no outgoing calls