Skip to content

Commit 6c2ed33

Browse files
committed
Merge pull request #1299 from pguyot/w39/add-support-for-io-put_chars-2
Add support for `io:put_chars/2` These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 389ec97 + e83188d commit 6c2ed33

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ also non string parameters (e.g. `Enum.join([1, 2], ",")`
2929
- Add support to Elixir for `Keyword.split/2`
3030
- Support for `binary:split/3` and `string:find/2,3`
3131
- Support for large tuples (more than 255 elements) in external terms.
32+
- Support for `io:put_chars/2`
3233

3334
### Changed
3435

libs/estdlib/src/io.erl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
%%-----------------------------------------------------------------------------
2828
-module(io).
2929

30-
-export([format/1, format/2, get_line/1, put_chars/1]).
30+
-export([format/1, format/2, get_line/1, put_chars/1, put_chars/2]).
3131

3232
%%-----------------------------------------------------------------------------
3333
%% @doc Equivalent to format(Format, []).
@@ -96,3 +96,15 @@ put_chars(Chars) ->
9696
{io_reply, Ref, Line} -> Line
9797
end
9898
end.
99+
100+
%%-----------------------------------------------------------------------------
101+
%% @param Chars character(s) to write to console
102+
%% @returns ok
103+
%% @doc Writes the given character(s) to the console.
104+
%% @end
105+
%%-----------------------------------------------------------------------------
106+
-spec put_chars(Device :: any(), Chars :: list() | binary()) -> ok.
107+
put_chars(standard_error, Chars) ->
108+
put_chars(Chars);
109+
put_chars(standard_output, Chars) ->
110+
put_chars(Chars).

0 commit comments

Comments
 (0)