Skip to content

Conversation

@petermm
Copy link
Contributor

@petermm petermm commented Jan 28, 2026

Elixir users, and presumably various AI, and editors
has a tendency to inadvertently call io:format
with an Elixir string eg a binary:

:io.format("----->create_net: ok, ip_info=~p~n", [ip_info])

Which crashes, with function_clause error..

This allows the binary, as the underlying
io_lib:format(Format, Args) handles the Format
being a binary

format(Format, Args) when is_binary(Format) ->

Also fixes the spec, including return spec since
put_chars/2 returns ok

Fixes #2078

  • see issue for confusing error/Crash

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

Elixir users, and presumably various AI, and Editors
has a tendency to inadvertently call io:format
with an Elixir string eg a binary:

:io.format("----->create_net: ok, ip_info=~p~n", [ip_info])

Which crashes, with function_clause error..

This allows the binary, as the underlying
io_lib:format(Format, Args) handles the Format
being a binary
https://github.com/atomvm/AtomVM/blob/887e71a98f28df52e6d6f41d344cad685092cf2b/libs/estdlib/src/io_lib.erl#L74

Also fixes the spec, including return spec since
put_chars/2 returns ok

Fixes atomvm#2078
- see issue for confusing error/Crash

Signed-off-by: Peter M <petermm@gmail.com>
@petermm petermm force-pushed the fix-io-format-binary branch from ab87242 to cafdbde Compare January 28, 2026 22:53
@bettio bettio merged commit 3269245 into atomvm:main Jan 29, 2026
141 of 142 checks passed
@petermm petermm deleted the fix-io-format-binary branch January 29, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

:network.wait_for_sta() crash with pattern_match

2 participants