From 37480288aeb42f4d3d831a5a8320873763dd304a Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 30 Nov 2017 15:45:08 +0000 Subject: [PATCH] Improve git-prompt compilation error message --- prompt_fresh_setup | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/prompt_fresh_setup b/prompt_fresh_setup index 9efa9fb..60904ba 100644 --- a/prompt_fresh_setup +++ b/prompt_fresh_setup @@ -122,9 +122,10 @@ visible_length() { compile_git_prompt() { # Compile a simple C executable which parses the output of `git status # --procelain` to greatly decrease the time taken to render the prompt - if [ ! -d ~/.cache/zsh ]; then mkdir -p ~/.cache/zsh; fi - if [ ! -f ~/.cache/zsh/git-prompt ]; then - cc -x c -std=gnu99 -O3 -DNDEBUG -o ~/.cache/zsh/git-prompt - << EOF + local cache=~/.cache/zsh + if [ ! -d $cache ]; then mkdir -p $cache; fi + if [ ! -f $cache/git-prompt ]; then + cc -x c -std=gnu99 -O3 -DNDEBUG -o $cache/git-prompt - 2> /dev/null << EOF #include #include @@ -176,6 +177,9 @@ int main() { return 0; } EOF + if [ $? -ne 0 ]; then + echo "git prompt disabled, are the system development headers installed?" + fi fi }