%% %CopyrightBegin%
%%
%% SPDX-License-Identifier: Apache-2.0
%%
%% Copyright Ericsson AB 2021-2025. All Rights Reserved.
%%
%% %CopyrightEnd%

[;1m  port_command(Port, Data, OptionList)[0m

  Sends data to a port. [;;4mport_command(Port, Data, [])[0m equals [;;4m[0m
  [;;4mport_command(Port, Data)[0m.

  If the port command is aborted, [;;4mfalse[0m is returned, otherwise [;;4m[0m
  [;;4mtrue[0m.

  If the port is busy, the calling process is suspended until the
  port is not busy anymore.

  [;;4mOption[0ms:

   • [;;4mforce[0m - The calling process is not suspended if the port is
     busy, instead the port command is forced through. The call
     fails with a [;;4mnotsup[0m exception if the driver of the port
     does not support this. For more information, see driver flag [;;4m[0m
     [;;4mERL_DRV_FLAG_SOFT_BUSY[0m.

   • [;;4mnosuspend[0m - The calling process is not suspended if the
     port is busy, instead the port command is aborted and [;;4mfalse[0m
     is returned.

  [;;4mChange[0m

    More options can be added in a future release.

  Failures:

   • [;;4mbadarg[0m - If [;;4mPort[0m is not an identifier of an open port, or
     the registered name of an open port. If the calling process
     was previously linked to the closed port, identified by [;;4m[0m
     [;;4mPort[0m, the exit signal from the port is guaranteed to be
     delivered before this [;;4mbadarg[0m exception occurs.

   • [;;4mbadarg[0m - If [;;4mData[0m is an invalid I/O list.

   • [;;4mbadarg[0m - If [;;4mOptionList[0m is an invalid option list.

   • [;;4mnotsup[0m - If option [;;4mforce[0m has been passed, but the driver
     of the port does not allow forcing through a busy port.

  [;;4mWarning[0m

    Do not send data to an unknown port. Any undefined behavior is
    possible (including node crash) depending on how the port
    driver interprets the data.
