浏览代码

fix(installer): fix removal of OMZ directory on failure

When the `git init` call fails, the directory is not created,
so the rm command fails with a not found error. This change
checks whether the directory exists before deleting it.
Marc Cornellà 2 年之前
父节点
当前提交
c81804825c
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      tools/install.sh

+ 1 - 1
tools/install.sh

@@ -283,7 +283,7 @@ setup_ohmyzsh() {
   && git remote add origin "$REMOTE" \
   && git fetch --depth=1 origin \
   && git checkout -b "$BRANCH" "origin/$BRANCH" || {
-    rm -rf "$ZSH"
+    [ ! -d "$ZSH" ] || rm -rf "$ZSH" 2>/dev/null
     fmt_error "git clone of oh-my-zsh repo failed"
     exit 1
   }