-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue about os.homedir()
#5582
Comments
+1 |
There is work going on in libuv/libuv#742 to get the current user's password file entry. This would bypass the |
I wrote a package called real-homedir. Actrully it's a copy of So what I mean is that to replace |
@XadillaX I don't think adding the new function |
IIRC there was actually requests to use |
@Fishrock123 Yeah I agree with But I'm talking about the situation above like How to solve it in Node.js and let developers be comfortable with it? |
+1. provide warning when |
os.userInfo() calls libuv's uv_os_get_passwd() function. It returns an object containing the current effective user's username, uid, gid, shell, and home directory. On Windows, the uid and gid are -1, and the shell is null. Refs: nodejs#5582 PR-URL: nodejs#6104 Reviewed-By: James M Snell <[email protected]>
Moving forward, you can use |
os.userInfo() calls libuv's uv_os_get_passwd() function. It returns an object containing the current effective user's username, uid, gid, shell, and home directory. On Windows, the uid and gid are -1, and the shell is null. Refs: #5582 PR-URL: #6104 Reviewed-By: James M Snell <[email protected]>
I saw
os.homedir()
is directly usinguv_os_homedir
and it has an strange feature.It will check the environment variable first and then check for the real home directory.
And someone discussed here for the reason.
But I think there's still a problem.
Consider one situation:
One solution is to edit
/etc/sudoers
:And another method is using
-i
argument._For further reading you can go to this article. (It was written in Chinese by @Amunu)_
But I think why don't we wrote a
os.realHomedir()
or removing checkingHOME
inrealhomedir()
? Not all of us (normal developers) have the permission to access configuration files on our online servers.The text was updated successfully, but these errors were encountered: