abiosoft / ishell

Library for creating interactive cli applications.
MIT License
1.68k stars 195 forks source link

Use environment variables for home directory #126

Closed karagenc closed 1 year ago

karagenc commented 5 years ago

I want to revert my commit, because the new method of getting the user home directory doesn't work with sudo -E

For example, let's assume that I am "foo" user, and I wrote a program using ishell (let's name the program as "bar"), and I run the command: sudo -E ./bar

It retrieves root's home directory path, not foo's. Because user.Current uses /etc/passwd instead of environment variables. I think we should use environment variables to retrieve the user home directory path.