From 2740baa993c22d700ed17566bbfddb5ac8173168 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 22 Feb 2023 15:24:29 -0700 Subject: loc_tools: Print $^E when upon a libc failure This makes debugging easier. --- t/loc_tools.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/loc_tools.pl b/t/loc_tools.pl index e897ad6286..6150bbf1c0 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -206,8 +206,12 @@ sub _trylocale ($$$$) { # For use only by other functions in this file! # We definitely don't want the locale set to something that is # unsupported - die "Couldn't restore locale '$save_locale', category $category" - unless setlocale($category, $save_locale); + if (! setlocale($category, $save_locale)) { + my $error_text = "\$!=$!"; + $error_text .= "; \$^E=$^E" if $^E != $!; + die "Couldn't restore locale '$save_locale', category $category;" + . $error_text; + } if ($badutf8) { _my_fail("Verify locale name doesn't contain malformed utf8"); return; -- cgit v1.2.1