summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <hello@mcornella.com>2022-02-25 14:06:19 +0100
committerMarc Cornellà <hello@mcornella.com>2022-02-25 14:06:19 +0100
commitc81804825c03e563ab748aae84c3f63458961208 (patch)
tree90679907c12bad620e5b81a81e2377671d28d88e
parent99460351eb8d8d9d5ea2e44b66e1b9ceaaa4a368 (diff)
downloadzsh-c81804825c03e563ab748aae84c3f63458961208.tar.gz
zsh-c81804825c03e563ab748aae84c3f63458961208.tar.bz2
zsh-c81804825c03e563ab748aae84c3f63458961208.zip
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.
-rwxr-xr-xtools/install.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/install.sh b/tools/install.sh
index 7953ad112..93608eb7c 100755
--- a/tools/install.sh
+++ b/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
}