MCPcopy
hub / github.com/runfinch/finch / getOSVersion

Method getOSVersion

pkg/support/support.go:356–380  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

354}
355
356func (bb *bundleBuilder) getOSVersion() (string, error) {
357 var cmd command.Command
358 switch runtime.GOOS {
359 case "windows":
360 cmd = bb.ecc.Create("cmd", "/c", "ver")
361 case "darwin":
362 cmd = bb.ecc.Create("sw_vers", "-productVersion")
363 case "linux":
364 cmd = bb.ecc.Create("uname", "-r")
365 default:
366 cmd = nil
367 }
368
369 if cmd == nil {
370 return "unknown", nil
371 }
372
373 out, err := cmd.Output()
374 if err != nil {
375 return "", err
376 }
377
378 os := strings.TrimSuffix(string(out), "\n")
379 return os, nil
380}
381
382func (bb *bundleBuilder) getArch() string {
383 return system.NewStdLib().Arch()

Callers 1

getPlatformDataMethod · 0.95

Calls 2

OutputMethod · 0.95
CreateMethod · 0.65

Tested by

no test coverage detected