aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorDominyk Tiller2016-08-01 04:07:59 +0100
committerDominyk Tiller2016-08-02 03:50:49 +0100
commitde4016e0496b05d20d35d3dabbe328b7f32781d6 (patch)
treea78e5ec7705d08238c47c992d4164f0155d29301 /Library
parentf10370bde5e9fd2096e61110425d258a536961bb (diff)
downloadbrew-de4016e0496b05d20d35d3dabbe328b7f32781d6.tar.bz2
utils: add with_custom_locale helper
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 4e8da3c24..f78fbfcb7 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -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