Skip to content

Commit 0c1395c

Browse files
committed
Do not set encoding on Erlang/OTP 26
1 parent 1b3f9f8 commit 0c1395c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/elixir/src/elixir.erl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
-export([start/2, stop/1, config_change/3]).
2626

2727
start(_Type, _Args) ->
28-
_ = parse_otp_release(),
28+
OTP = parse_otp_release(),
2929
preload_common_modules(),
30-
set_stdio_and_stderr_to_binary_and_maybe_utf8(),
30+
set_stdio_and_stderr_to_binary_and_maybe_utf8(OTP),
3131
check_file_encoding(file:native_name_encoding()),
3232

3333
case application:get_env(elixir, check_endianness, true) of
@@ -87,7 +87,10 @@ stop(Tab) ->
8787
config_change(_Changed, _New, _Remove) ->
8888
ok.
8989

90-
set_stdio_and_stderr_to_binary_and_maybe_utf8() ->
90+
set_stdio_and_stderr_to_binary_and_maybe_utf8(OTP) when OTP >= 26 ->
91+
ok = io:setopts(standard_io, [binary]),
92+
ok;
93+
set_stdio_and_stderr_to_binary_and_maybe_utf8(_OTP) ->
9194
%% In case there is a shell, we can't really change its
9295
%% encoding, so we just set binary to true. Otherwise
9396
%% we must set the encoding as the user with no shell

0 commit comments

Comments
 (0)