Skip to content
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

Handling PATH #36

Closed
manojlds opened this issue Jan 5, 2016 · 11 comments
Closed

Handling PATH #36

manojlds opened this issue Jan 5, 2016 · 11 comments

Comments

@manojlds
Copy link
Contributor

manojlds commented Jan 5, 2016

PATH for the app is limited. Most commands that I want to run, like docker, are not in PATH for the app. This makes it very limited regarding what I can write in the plugins.

Would like to know what people are doing for this. I would also like to make a recommendation that PATH from login shell is somehow incorporated, as the premise is running custom scripts that work in our terminals.

@manojlds
Copy link
Contributor Author

manojlds commented Jan 5, 2016

export PATH='/usr/local/bin:$PATH'

in the plugin is a workaround for now.

@matryer
Copy link
Owner

matryer commented Jan 5, 2016

Perhaps you could add that to the README? It's a cool little trick.

@matryer
Copy link
Owner

matryer commented Jan 5, 2016

Do you think this requires a change in BitBar, or is adding the path 'manually' a good solution?

@uri
Copy link

uri commented Jan 5, 2016

How do you export PATH if your script isn't using bash?

@alaroldai
Copy link

@uri depends on what language you're using.

A more portable solution might be to have the app pull PATH from a login shell session on reset - this is the strategy used in neovim.app (see https://github.com/rogual/neovim-dot-app/blob/master/src/app.mm)

@manojlds
Copy link
Contributor Author

manojlds commented Jan 5, 2016

+1 to @alaroldai

@matryer
Copy link
Owner

matryer commented Jan 6, 2016

The trouble is, which login shell should it pull from? People use different ones. And which file? .bash_profile, .bash_rc, or something else?

It seems more elegant to let the plugin developer decide what to pull in?

@alaroldai
Copy link

Well, it is possible to check which shell the user has set as their default shell. On Mac OS, you can do this with: dscl . read /Users/alaroldai UserShell | cut -f2 -d' '. There's also the OpenDirectory framework, which afaik is the underlying implementation of users, groups, shells, and lots of other stuff as well. I believe that iTerm2 uses this approach, though running dscl in a subprocess might be simpler for a quick win/proof-of-concept.

@matryer
Copy link
Owner

matryer commented Feb 17, 2016

Are we happy that this issue is resolved in userland?

@manojlds
Copy link
Contributor Author

Yea

@tkothe
Copy link

tkothe commented Apr 21, 2020

Just in case anybody else is wondering for a moment why @manojlds's solution above is not working for them: Use double quotes instead of single quotes so that $PATH actually gets expanded.
i.e. PATH="/usr/local/bin:$PATH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants