Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for formatting ports #1474

Open
wants to merge 2 commits into
base: feature/distributed-erlang
Choose a base branch
from

Conversation

UncleGrumpy
Copy link
Collaborator

@UncleGrumpy UncleGrumpy commented Jan 15, 2025

Add support for io_lib (and io, etc...) to format ports.
Adds port_to_list/1 to erlang module exports to keep dialyzer happy.
Adds a missing clause to handle port terms in memory_estimate_usage(term) function that is necessary for formatting ports for io or other purposes.

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

Adds a missing clause to handle port terms in `memory_estimate_usage(term)` function that is necessary
for formatting ports for io or other purposes.

Signed-off-by: Winford <[email protected]>
Add support for io_lib (and io, etc...) to format ports.

Adds port_to_list/1 to erlang module exports to keep dialyzer happy.

Signed-off-by: Winford <[email protected]>
@@ -292,6 +292,8 @@ format_spw(_Format, T) when is_float(T) ->
erlang:float_to_list(T);
format_spw(_Format, T) when is_pid(T) ->
erlang:pid_to_list(T);
format_spw(_Format, T) when is_port(T) ->
erlang:port_to_list(T);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much.
Could we have a test for this clause that passes on both BEAM and AtomVM?

open_port({spawn, "echo"}, []) works on both platforms AFAIK.

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.

2 participants