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

only try fc-cache reset on linux #134

Merged
merged 2 commits into from
Nov 18, 2015
Merged

Conversation

CarlQLange
Copy link
Contributor

fc-cache doesn't exist on osx :)

fc-cache doesn't exist on osx :)
@Lokaltog
Copy link
Member

I'm pretty sure if [[ -n -which fc-cache]] checks if fc-cache exists in $PATH, so this command shouldn't run if fc-cache is unavailable.

@Lokaltog Lokaltog closed this Nov 18, 2015
@CarlQLange
Copy link
Contributor Author

fyi it did actually try to run fc-cache on my machine, hence the need for this patch, as the script bombed out without it.

if [[-n `which fc-cache ]]

actually checks if the output of which fc-cache and tests if it's a null string or not. At least on my machine, if which can't find fc-cache, it says 'fc-cache not found', not an empty string. A better test is something like:

if command -v fc-cache 2>/dev/null; then fc-cache -f $font_dir; fi

Here's more info about why you should avoid which in this script

And here's a screenshot of the current if not working:

screen shot 2015-11-18 at 08 33 49

@Lokaltog
Copy link
Member

Allright, that makes sense. On Linux the output of which is empty if the command doesn't exist, I didn't realize this behavior isn't consistent across systems. I think that instead of testing the uname output we should fix the issue with using which so it works consistently across systems.

I agree with the if command... solution you posted, if you could update the PR I'll merge it.

@Lokaltog Lokaltog reopened this Nov 18, 2015
@CarlQLange
Copy link
Contributor Author

OK, updated. You might want to make sure it works the same way on your system. It works fine for me now. :)

Lokaltog added a commit that referenced this pull request Nov 18, 2015
only try fc-cache reset on linux
@Lokaltog Lokaltog merged commit 6ac4c01 into powerline:master Nov 18, 2015
@Lokaltog
Copy link
Member

Works like a charm, thanks a lot!

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

Successfully merging this pull request may close these issues.

2 participants