(str string)
| 1060 | } |
| 1061 | |
| 1062 | func systemdVersionAtoi(str string) (int, error) { |
| 1063 | // Unconditionally remove the leading prefix ("v). |
| 1064 | str = strings.TrimLeft(str, `"v`) |
| 1065 | // Match on the first integer we can grab. |
| 1066 | for i := range len(str) { |
| 1067 | if str[i] < '0' || str[i] > '9' { |
| 1068 | // First non-digit: cut the tail. |
| 1069 | str = str[:i] |
| 1070 | break |
| 1071 | } |
| 1072 | } |
| 1073 | ver, err := strconv.Atoi(str) |
| 1074 | if err != nil { |
| 1075 | return -1, fmt.Errorf("can't parse version: %w", err) |
| 1076 | } |
| 1077 | return ver, nil |
| 1078 | } |
| 1079 | |
| 1080 | func startUnit(conn *systemdDbus.Conn, group string, properties []systemdDbus.Property, ignoreExists bool) error { |
| 1081 | ctx := context.TODO() |
no outgoing calls
no test coverage detected
searching dependent graphs…