()
| 362 | var macOSVersionRegex = regexp.MustCompile(`^(\d+\.\d+(?:\.\d+)?)`) |
| 363 | |
| 364 | func internalMacOSVersion() string { |
| 365 | ctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second) |
| 366 | defer cancelFn() |
| 367 | out, err := exec.CommandContext(ctx, "sw_vers", "-productVersion").Output() |
| 368 | if err != nil { |
| 369 | return "" |
| 370 | } |
| 371 | versionStr := strings.TrimSpace(string(out)) |
| 372 | m := macOSVersionRegex.FindStringSubmatch(versionStr) |
| 373 | if len(m) < 2 { |
| 374 | return "" |
| 375 | } |
| 376 | return m[1] |
| 377 | } |
| 378 | |
| 379 | func ClientMacOSVersion() string { |
| 380 | if runtime.GOOS != "darwin" { |
no test coverage detected