MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / internalMacOSVersion

Function internalMacOSVersion

pkg/wavebase/wavebase.go:364–377  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

362var macOSVersionRegex = regexp.MustCompile(`^(\d+\.\d+(?:\.\d+)?)`)
363
364func 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
379func ClientMacOSVersion() string {
380 if runtime.GOOS != "darwin" {

Callers 1

ClientMacOSVersionFunction · 0.85

Calls 1

OutputMethod · 0.80

Tested by

no test coverage detected