Skip to content

Commit

Permalink
fix: Support GID and UID on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pojntfx committed Dec 24, 2021
1 parent 0876307 commit 8b09fd4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/fs/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,22 @@ func (f *FileSystem) mknode(dir bool, name string, perm os.FileMode) error {

uid, err := strconv.Atoi(usr.Uid)
if err != nil {
return err
// Some OSes like i.e. Windows don't support numeric UIDs, so use 0 instead
if err == strconv.ErrSyntax {
uid = 0
} else {
return err
}
}

gid, err := strconv.Atoi(usr.Gid)
if err != nil {
return err
// Some OSes like i.e. Windows don't support numeric GIDs, so use 0 instead
if err == strconv.ErrSyntax {
gid = 0
} else {
return err
}
}

groups, err := usr.GroupIds()
Expand Down

0 comments on commit 8b09fd4

Please sign in to comment.