Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence setlocale warnings in Java stub #17670

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,15 @@ function is_macos() {
function available_utf8_locale() {
# Both C.UTF-8 and en_US.UTF-8 do not cause any language-specific effects
# when set as LC_CTYPE, but neither is certain to exist on all systems.
if [[ $(LC_CTYPE=C.UTF-8 locale charmap 2>/dev/null) == "UTF-8" ]]; then
#
# https://github.com/bazelbuild/bazel/pull/17670: Note that the use of "env"
# is important in these calls. Without "env", bash itself seems to pick up
# the LC_CTYPE change as soon as the variable is defined and may emit a
# warning when the locale files are not present. By using "env", bash never
# sees the change and the 2>/dev/null redirection does the right thing.
if [[ "$(env LC_CTYPE=C.UTF-8 locale charmap 2>/dev/null)" == "UTF-8" ]]; then
echo "C.UTF-8"
elif [[ $(LC_CTYPE=en_US.UTF-8 locale charmap 2>/dev/null) == "UTF-8" ]]; then
elif [[ "$(env LC_CTYPE=en_US.UTF-8 locale charmap 2>/dev/null)" == "UTF-8" ]]; then
echo "en_US.UTF-8"
fi
}
Expand Down