package thin import ( "path/filepath" "strings" "amadan.net/oficina/equipo/internal/runner" ) // A Mac's tool sockets (Mac runners spec ยง8.2). Linux binds a step's tool // socket through its directory's descriptor, so the path's length never // matters there. A Mac has no /proc/self/fd: the CLI's tool endpoint // dials the socket by its path, which must fit sun_path // (provider.MaxDarwinSocketPath). The state directory with Linux's names // does not fit a long home, so a Mac's go under the scratch root's short // t/, each in a directory named only by MkdirTemp's random number (at // most 10 digits), as s. const ( macToolDirPrefix = "" macToolSocketName = "s" // macToolHomeName is the longest runner user name whose sockets fit, // for install_mac.go's roots (~/.local/share/equipo-runner/scratch): // /Users//.local/share/equipo-runner/scratch/t/<10 digits>/s. macToolHomeName = 46 ) // macToolRoot is the directory a Mac's tool sockets go under. func macToolRoot(c runner.Config) string { return filepath.Join(c.ScratchRoot, "t") } // macToolSocketLongest is the longest tool socket path a Mac makes under // root. func macToolSocketLongest(root string) string { return filepath.Join(root, macToolDirPrefix+strings.Repeat("9", 10), macToolSocketName) }