Skip to content

Erlang/OTP 26 stdin fails on file:read/file:read_line #7230

@josevalim

Description

@josevalim

Describe the bug

$ echo "duπa" | erl -noshell -eval "io:setopts(standard_io, [{encoding, latin1}, {binary, true}]), io:format('~p~n', [file:read_line(standard_io)]), erlang:halt()"
{error, collect_line}

Expected behavior

On Erlang/OTP 25 it worked without problems:

$ echo "duπa" | erl -noshell -eval "io:setopts(standard_io, [{encoding, latin1}, {binary, true}]), io:format('~p~n', [file:read_line(standard_io)]), erlang:halt()"
{ok,<<100,117,207,128,97,10>>}

The goal is to read a bytestream, "duπa" is just an example.

Affected versions

Only on Erlang/OTP 26. This patch fixes stdout, perhaps similar is needed for stdin?

Metadata

Metadata

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions