Defer uid lookups on Darwin

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko 2023-03-27 10:24:01 -07:00
parent f7f2be7321
commit 87346df54f

View File

@ -607,7 +607,9 @@ func WithUser(userstr string) SpecOpts {
// The `Username` field on the runtime spec is marked by Platform as only for Windows, and in this case it
// *is* being set on a Windows host at least, but will be used as a temporary holding spot until the guest
// can use the string to perform these same operations to grab the uid:gid inside.
if s.Windows != nil && s.Linux != nil {
//
// Mounts are not supported on Darwin, so using the same workaround.
if (s.Windows != nil && s.Linux != nil) || runtime.GOOS == "darwin" {
s.Process.User.Username = userstr
return nil
}