extractIDFromStatusLine extracts the ID from a status line in the format "Key:\tValue".
(line string)
| 1055 | |
| 1056 | // extractIDFromStatusLine extracts the ID from a status line in the format "Key:\tValue". |
| 1057 | func extractIDFromStatusLine(line string) int { |
| 1058 | fields := strings.Fields(line) |
| 1059 | if len(fields) == 2 { |
| 1060 | id, err := strconv.Atoi(fields[1]) |
| 1061 | if err == nil { |
| 1062 | return id |
| 1063 | } |
| 1064 | } |
| 1065 | return -1 |
| 1066 | } |
| 1067 | |
| 1068 | // findChildPIDs takes a parent PID and returns a slice of all descendant PIDs. |
| 1069 | func findChildPIDs(parentPID int) ([]int, error) { |