aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Afanasjew2015-11-20 20:52:29 +0100
committerMartin Afanasjew2015-12-01 21:36:05 +0100
commit8f175cb03c57ac3a426d7cc1420f2b65aeaafd22 (patch)
tree3f66e7e082c8fd5d212bbcd1624e6c6ae8a59fd9
parent73a7889de57135858d1484f9c7e4e2ce726e3f4a (diff)
downloadbrew-8f175cb03c57ac3a426d7cc1420f2b65aeaafd22.tar.bz2
bin/brew: separate variable assignment and export
This very slightly reduces duplication and the risk of inconsistency by exporting in one branch, but not the other. By putting all the `export` statements right before the `exec` it is more obvious what is passed on.
-rwxr-xr-xbin/brew9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/brew b/bin/brew
index 382c78f64..c3468aaac 100755
--- a/bin/brew
+++ b/bin/brew
@@ -4,7 +4,7 @@ chdir() {
}
BREW_FILE_DIRECTORY="$(chdir "${0%/*}" && pwd -P)"
-export HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}"
+HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}"
BREW_SYMLINK="$(readlink "$0")"
if [ -n "$BREW_SYMLINK" ]
@@ -31,10 +31,13 @@ then
BREW_SYSTEM="$(uname -s | tr "[:upper:]" "[:lower:]")"
if [ "$BREW_SYSTEM" = "darwin" ]
then
- export HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby"
+ HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby"
else
- export HOMEBREW_RUBY_PATH="$(which ruby)"
+ HOMEBREW_RUBY_PATH="$(which ruby)"
fi
fi
+export HOMEBREW_BREW_FILE
+export HOMEBREW_RUBY_PATH
+
exec "$HOMEBREW_RUBY_PATH" -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"