diff options
author | Lukas Larsson <[email protected]> | 2015-07-13 15:38:41 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2015-12-15 10:05:37 +0100 |
commit | 4b98e710b9c45481c1cdc7a4ee68f7ce7fca908a (patch) | |
tree | 85540d384eacdc9e15c6ffbbaacac9ff053c0ba1 /erts/preloaded/src/erlang.erl | |
parent | 6f760fcaf2608cc25684e17660a95e51f080c7af (diff) | |
download | otp-4b98e710b9c45481c1cdc7a4ee68f7ce7fca908a.tar.gz otp-4b98e710b9c45481c1cdc7a4ee68f7ce7fca908a.tar.bz2 otp-4b98e710b9c45481c1cdc7a4ee68f7ce7fca908a.zip |
erts: Add support for asynchronous open_port
OTP-13086
Diffstat (limited to 'erts/preloaded/src/erlang.erl')
-rw-r--r-- | erts/preloaded/src/erlang.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/erts/preloaded/src/erlang.erl b/erts/preloaded/src/erlang.erl index 7280b43502..4c22c596eb 100644 --- a/erts/preloaded/src/erlang.erl +++ b/erts/preloaded/src/erlang.erl @@ -2027,8 +2027,14 @@ nodes(_Arg) -> | eof | {parallelism, Boolean :: boolean()} | hide. -open_port(_PortName,_PortSettings) -> - erlang:nif_error(undefined). +open_port(PortName, PortSettings) -> + case case erts_internal:open_port(PortName, PortSettings) of + Ref when erlang:is_reference(Ref) -> receive {Ref, Res} -> Res end; + Res -> Res + end of + Port when erlang:is_port(Port) -> Port; + Error -> erlang:error(Error, [PortName, PortSettings]) + end. -type priority_level() :: low | normal | high | max. |