Closed ThatXliner closed 2 years ago
I personally like checking for the parent process if possible, because it seems more reliable to me. Also, adding a path to the system PATH is probably a one-time occurrence, so I would argue it's ok if it's not blazing fast.
Here is an example where checking the SHELL
variable fails to yield the proper information:
zsh > echo $SHELL
/bin/zsh
zsh > bash
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash > echo $SHELL
/bin/zsh
In this case, querying the parent process would correctly identify 'bash'.
I'm keeping this behavior.
https://github.com/ofek/userpath/blob/a763ba69a90368f69e3a054a8ceadb775ac78ff0/userpath/interface.py#L81
That seems kind of hacky and I guess we would want to reduce subprocess calls. Check for the SHELL variable first.