utils: add with_custom_locale helper

This commit is contained in:
Dominyk Tiller 2016-08-01 04:07:59 +01:00
parent f10370bde5
commit de4016e049
No known key found for this signature in database
GPG Key ID: FE19AEFCF658C6F6

View File

@ -337,6 +337,14 @@ ensure
ENV["PATH"] = old_path
end
def with_custom_locale(locale)
old_locale = ENV["LC_ALL"]
ENV["LC_ALL"] = locale
yield
ensure
ENV["LC_ALL"] = old_locale
end
def run_as_not_developer(&_block)
old = ENV.delete "HOMEBREW_DEVELOPER"
yield