brew

https://github.com/homebrew/brew

Ruby

🍺 The missing package manager for macOS

#with_env

Calls the given block with the passed environment variables
added to ENV, then restores ENV afterwards.
Example:
with_env "PATH" => "/bin" do
  system "echo $PATH"
end

Note that this method is *not* thread-safe - other threads
which happen to be scheduled during the block will also
see these environment variables.

Source | Google | Stack overflow

Edit

git clone [email protected]:homebrew/brew.git

cd brew

open Library/Homebrew/utils.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs--with_env-for-pr


# Commit to git

git add Library/Homebrew/utils.rbgit commit -m "better docs for #with_env"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs--with_env-for-pr

hub pull-request


# Celebrate!