summaryrefslogtreecommitdiff
path: root/t/run
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2014-04-14 15:26:18 +0100
committerDavid Mitchell <davem@iabyn.com>2014-04-14 15:37:17 +0100
commitff4377fe256e32a3bc10175c01dd6c68c9ce7ddb (patch)
tree3a394ca7c883b29407c5b45fbbfeeb8892064a82 /t/run
parentec71b45ff5bd29dba69fd98d31a0be1dbc323b3c (diff)
downloadperl-ff4377fe256e32a3bc10175c01dd6c68c9ce7ddb.tar.gz
run/locale.t: silence shell warnings
A couple of tests do local $ENV{LC_ALL} = "invalid"; fresh_perl_is(...); this causes a shell to be invoked with an invalid locale. Some shells such as bash, become very noisy in this case: $ LC_ALL=invalid /bin/sh -c 'echo yes' /bin/sh: warning: setlocale: LC_ALL: cannot change locale (invalid): No such file or directory yes $ Silence these warnings by temporarily closing STDERR. Since the fresh_perl_is() scripts themselves are run with STDERR set to /dev/null anyway, this isn't a hardship.
Diffstat (limited to 't/run')
-rw-r--r--t/run/locale.t12
1 files changed, 12 insertions, 0 deletions
diff --git a/t/run/locale.t b/t/run/locale.t
index f522e0fa55..82872148e9 100644
--- a/t/run/locale.t
+++ b/t/run/locale.t
@@ -200,6 +200,15 @@ EOF
"Uses the above test to verify that on Windows the system default locale has lower priority than LC_NUMERIC");
}
+
+ # within this block, STDERR is closed. This is because fresh_perl_is()
+ # forks a shell, and some shells (like bash) can complain noisily when
+ #LC_ALL or similar is set to an invalid value
+
+ {
+ open my $saved_stderr, ">&STDERR" or die "Can't dup STDERR: $!";
+ close STDERR;
+
for ($different) {
local $ENV{LC_ALL} = "invalid";
local $ENV{LC_NUMERIC} = "invalid";
@@ -239,6 +248,9 @@ EOF
}
}
+ open STDERR, ">&", $saved_stderr or die "Can't dup \$saved_stderr: $!";
+ }
+
for ($different) {
local $ENV{LC_NUMERIC} = $_;
local $ENV{LC_ALL}; # so it never overrides LC_NUMERIC