Improve git-prompt compilation error message

This commit is contained in:
Kenneth Benzie 2017-11-30 15:45:08 +00:00
parent 35942cdc09
commit 37480288ae

View File

@ -122,9 +122,10 @@ visible_length() {
compile_git_prompt() { compile_git_prompt() {
# Compile a simple C executable which parses the output of `git status # Compile a simple C executable which parses the output of `git status
# --procelain` to greatly decrease the time taken to render the prompt # --procelain` to greatly decrease the time taken to render the prompt
if [ ! -d ~/.cache/zsh ]; then mkdir -p ~/.cache/zsh; fi local cache=~/.cache/zsh
if [ ! -f ~/.cache/zsh/git-prompt ]; then if [ ! -d $cache ]; then mkdir -p $cache; fi
cc -x c -std=gnu99 -O3 -DNDEBUG -o ~/.cache/zsh/git-prompt - << EOF if [ ! -f $cache/git-prompt ]; then
cc -x c -std=gnu99 -O3 -DNDEBUG -o $cache/git-prompt - 2> /dev/null << EOF
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -176,6 +177,9 @@ int main() {
return 0; return 0;
} }
EOF EOF
if [ $? -ne 0 ]; then
echo "git prompt disabled, are the system development headers installed?"
fi
fi fi
} }