Closed uglygus closed 7 years ago
Using which
is technically not necessary here, since which
just resolves the binary location in $PATH
. I currently encounter the problem, that $PATH
is different from the user-defined $PATH
.
One workaround would be to open a shell, let it source the users dotfiles and then regularly call brew. Since some users (like me) tend to have rather complex dotfiles this slows down execution.
I'm further investigating possible solutions, nevertheless thank's for the contribution!
The way you will have it now would work for the vast majority of users. One solution might be to have a menu item that opens an Options or Preferences dialog to set it manually for these special cases or a config file.
On Sat, Jul 1, 2017 at 4:33 PM Jonas Höchst notifications@github.com wrote:
Using which is technically not necessary here, since which just resolves the binary location in $PATH. I currently encounter the problem, that $PATH is different from the user-defined $PATH.
One workaround would be to open a shell, let it source the users dotfiles and then regularly call brew. Since some uses (like me) tend to have rather complex dotfiles this slows down execution.
I'm further investigating possible solutions, nevertheless thank's for the contribution!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonashoechst/Syncthing-BrewBar/issues/1#issuecomment-312454194, or mute the thread https://github.com/notifications/unsubscribe-auth/ALDHwXgYbgWYWyewYMro6kdLkoOdRMJTks5sJq0NgaJpZM4OK9YJ .
@uglygus Could you please check out 5e662fdc10a88f7b2b40d4038f0d309773780ecd?
I ended up using path_helper
to load the user-defined $PATH
at program start and then set it in the environment, whenever a command is executed. This way brew should work as it does from the command line.
I tried 5e662fd. No luck.
Stepping through execCmd
the value of PATH
in the env
variable is not my my path as set in .bashrc. It is simply:
env PATH = ”/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Xcode.app/Contents/Developer/usr/bin"
then on line 72 task.launch()
outputs : env: brew: No such file or directory (lldb)
Next one to check out would be f7e7170405731bd22a8d5945ae33f482e8421c04...
The path_helper shell now also sources ~/.bashrc
, which is regularly only loaded for interactive shells. While this approach is a little hackish, at least for me it provides the PATH as seen in my login shell.
That works.
Great. So time for another beta release ;-)
Crashes when the hardcoded path of brew is not correct. My
brew
is located at /Users/USERNAME/homebrew/bin/brew I know this is unusual but you will probably want to allow for this somehow.I was looking for Swift's equivalent to the
which
commandline app but I couldn't find it. I'm no Swift coder so won't be able to solve this unfortunately.