[macOS] Can't expand home directory on if `$HOME` env var is missing
dvejmz opened this issue · 2 comments
dvejmz commented
This line within dirUnix()
(L87) fails in macOS, as it assumes getent
is installed, which is not the case for macOS, as this is a Unix/Linux-only utility.
cmd := exec.Command("getent", "passwd", strconv.Itoa(os.Getuid()))
This is the error that's returned
"getent": executable file not found in $PATH
Suggest detecting whether the user is on a Mac and use a Mac name resolving binary like dscacheutil
or dns-sd
.
mitchellh commented
Sounds like a good idea. At the least, we should verify getent exists before even attempting the all probably.