diff options
author | mpalmer <mpalmer@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-03 04:38:51 +0000 |
---|---|---|
committer | mpalmer <mpalmer@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-03 04:38:51 +0000 |
commit | 79dcd33aebf8749719e9eff009b8bb3fdaf77751 (patch) | |
tree | 98e2cd25da56bff8692beb5ac19d4c0cba75ca37 /test/util | |
parent | a1d4f3567d976b087a2986b202f0f457b8da5d0e (diff) | |
download | puppet-79dcd33aebf8749719e9eff009b8bb3fdaf77751.tar.gz puppet-79dcd33aebf8749719e9eff009b8bb3fdaf77751.tar.xz puppet-79dcd33aebf8749719e9eff009b8bb3fdaf77751.zip |
Set LANG/LC_ALL/LC_MESSAGES/LANGUAGE to 'C' whenever we execute things, so that the output that comes back is more easily parsed, without needing to understand all sorts of foreign languages
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2456 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/util')
-rwxr-xr-x | test/util/utiltest.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/util/utiltest.rb b/test/util/utiltest.rb index 07023d138..f0a91c49e 100755 --- a/test/util/utiltest.rb +++ b/test/util/utiltest.rb @@ -331,6 +331,32 @@ class TestPuppetUtil < Test::Unit::TestCase output = Puppet::Util.execute([patricidecommand], :failonfail => false) end end + + def test_lang_environ_in_execute + orig_lang = ENV["LANG"] + orig_lc_all = ENV["LC_ALL"] + orig_lc_messages = ENV["LC_MESSAGES"] + orig_language = ENV["LANGUAGE"] + + # Mmm, we love gettext(3) + ENV["LANG"] = "en_US" + ENV["LC_ALL"] = "en_US" + ENV["LC_MESSAGES"] = "en_US" + ENV["LANGUAGE"] = "en_US" + + %w{LANG LC_ALL LC_MESSAGES LANGUAGE}.each do |env| + assert_equal 'C', + Puppet::Util.execute(['ruby', '-e', "print ENV['#{env}']"]), + "Environment var #{env} wasn't set to 'C'" + + assert_equal 'en_US', ENV[env], "Environment var #{env} not set back correctly" + end + + ENV["LANG"] = orig_lang + ENV["LC_ALL"] = orig_lc_all + ENV["LC_MESSAGES"] = orig_lc_messages + ENV["LANGUAGE"] = orig_lc_messages + end # Check whether execute() accepts strings in addition to arrays. def test_string_exec |