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: Martin Afanasjew <martin@afanasjew.de>
This commit is contained in:
parent
359b67c6c8
commit
d4f5f0cec7
@ -311,7 +311,7 @@ EOS
|
||||
# only allow one instance of brew update
|
||||
lock update
|
||||
|
||||
chdir "$HOMEBREW_REPOSITORY"
|
||||
safe_cd "$HOMEBREW_REPOSITORY"
|
||||
git_init_if_necessary
|
||||
# rename Taps directories
|
||||
# this procedure will be removed in the future if it seems unnecessary
|
||||
@ -382,7 +382,7 @@ EOS
|
||||
pull "$DIR"
|
||||
done
|
||||
|
||||
chdir "$HOMEBREW_REPOSITORY"
|
||||
safe_cd "$HOMEBREW_REPOSITORY"
|
||||
|
||||
if [[ -n "$HOMEBREW_UPDATED" ||
|
||||
-n "$HOMEBREW_UPDATE_FAILED" ||
|
||||
|
@ -20,7 +20,7 @@ odie() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
chdir() {
|
||||
safe_cd() {
|
||||
cd "$@" >/dev/null || odie "Error: failed to cd to $*!"
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user