Describe the bug
After changing standard_io encoding to latin1 all writes to the output device hang.
To Reproduce
Run from windows command prompt
erl -noshell -eval "Path = os:find_executable('erl'), Port1 = erlang:open_port({spawn_executable, Path}, [binary, {args, ['-noshell', '-kernel', 'standard_io_encoding', 'latin1', '-eval', \"io:setopts(standard_io, [{encoding, latin1}]), io:format('duπa~n', []), erlang:halt()\"]}, exit_status]), receive {Port1, {data, A}} -> io:fwrite(A, []) after 2000 -> io:fwrite('nothing~n') end, erlang:halt()"
Result on windows
Expected behavior
Should print
it works correctly on OTP 25 both windows and *nix, and on OTP 26.0.2 on *nix
Affected versions
OTP 26.0.2
Additional context
This bug was tricky to track as it hangs only with a spawned process. If the same code is run directly from cmd shell it works correctly
erl -noshell -kernel standard_io_encoding latin1 -eval "io:setopts(standard_io, [{encoding, latin1}]), io:format('duπa~n', []), erlang:halt()"
prints
This bug breaks ElixirLS on windows elixir-lsp/elixir-ls#927
Possibly this is a regression of #7261 once fixed in 2bbeed3. The original script from that bug as well as a modified one hangs as well
-module(foo).
-compile(export_all).
run() ->
io:put_chars("START\n"),
open_port(
{spawn_executable, os:find_executable("erl")},
[exit_status, binary,
{args, ["-noshell", "-kernel", "standard_io_encoding", "latin1", "-eval", "io:setopts(standard_io, [{encoding, latin1}]), io:write('teπt'), erlang:halt()."]}]
),
loop().
loop() ->
receive
{_, {data, Data}} ->
io:put_chars(Data),
loop();
{_, {exit_status, _}} ->
erlang:halt()
end.
Related to #7230, #7384
Describe the bug
After changing
standard_ioencoding tolatin1all writes to the output device hang.To Reproduce
Run from windows command prompt
Result on windows
Expected behavior
Should print
it works correctly on OTP 25 both windows and *nix, and on OTP 26.0.2 on *nix
Affected versions
OTP 26.0.2
Additional context
This bug was tricky to track as it hangs only with a spawned process. If the same code is run directly from cmd shell it works correctly
prints
This bug breaks ElixirLS on windows elixir-lsp/elixir-ls#927
Possibly this is a regression of #7261 once fixed in 2bbeed3. The original script from that bug as well as a modified one hangs as well
Related to #7230, #7384