Skip to content
Snippets Groups Projects
Commit d4f5f0ce authored by Martin Afanasjew's avatar Martin Afanasjew
Browse files

brew.sh: rename 'chdir' to 'safe_cd'


This is inspired by `safe_system` with basically the same implication
(fail on error), making the name a lot less confusing and avoiding a
clash with the `chdir` function previously defined in `bin/brew`.

Closes #414.

Signed-off-by: default avatarMartin Afanasjew <martin@afanasjew.de>
parent 359b67c6
No related branches found
No related tags found
No related merge requests found
...@@ -311,7 +311,7 @@ EOS ...@@ -311,7 +311,7 @@ EOS
# only allow one instance of brew update # only allow one instance of brew update
lock update lock update
chdir "$HOMEBREW_REPOSITORY" safe_cd "$HOMEBREW_REPOSITORY"
git_init_if_necessary git_init_if_necessary
# rename Taps directories # rename Taps directories
# this procedure will be removed in the future if it seems unnecessary # this procedure will be removed in the future if it seems unnecessary
...@@ -382,7 +382,7 @@ EOS ...@@ -382,7 +382,7 @@ EOS
pull "$DIR" pull "$DIR"
done done
chdir "$HOMEBREW_REPOSITORY" safe_cd "$HOMEBREW_REPOSITORY"
if [[ -n "$HOMEBREW_UPDATED" || if [[ -n "$HOMEBREW_UPDATED" ||
-n "$HOMEBREW_UPDATE_FAILED" || -n "$HOMEBREW_UPDATE_FAILED" ||
......
...@@ -20,7 +20,7 @@ odie() { ...@@ -20,7 +20,7 @@ odie() {
exit 1 exit 1
} }
chdir() { safe_cd() {
cd "$@" >/dev/null || odie "Error: failed to cd to $*!" cd "$@" >/dev/null || odie "Error: failed to cd to $*!"
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment