From 9e967b4eccbe26701315860a3b0bad01fde725c8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20Cornell=C3=A0?= <hello@mcornella.com>
Date: Mon, 28 Mar 2022 16:33:03 +0200
Subject: [PATCH] fix(installer): exit install directory on setup (#10804)

---
 tools/install.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/install.sh b/tools/install.sh
index f04d0dc9c..495ad2c11 100755
--- a/tools/install.sh
+++ b/tools/install.sh
@@ -285,10 +285,15 @@ setup_ohmyzsh() {
   && git remote add origin "$REMOTE" \
   && git fetch --depth=1 origin \
   && git checkout -b "$BRANCH" "origin/$BRANCH" || {
-    [ ! -d "$ZSH" ] || rm -rf "$ZSH" 2>/dev/null
+    [ ! -d "$ZSH" ] || {
+      cd -
+      rm -rf "$ZSH" 2>/dev/null
+    }
     fmt_error "git clone of oh-my-zsh repo failed"
     exit 1
   }
+  # Exit installation directory
+  cd -
 
   echo
 }
-- 
2.21.0