File: rosetta_darwin.go

package info (click to toggle)
delve 1.26.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,136 kB
  • sloc: ansic: 111,947; sh: 194; asm: 147; makefile: 43; python: 23
file content (19 lines) | stat: -rw-r--r-- 432 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package macutil

import (
	"errors"
	"syscall"
)

// CheckRosetta returns an error if the calling process is being translated
// by Apple Rosetta.
func CheckRosetta() error {
	pt, err := syscall.Sysctl("sysctl.proc_translated")
	if err != nil {
		return nil
	}
	if len(pt) > 0 && pt[0] == 1 {
		return errors.New("can not run under Rosetta, check that the installed build of Go is right for your CPU architecture")
	}
	return nil
}