Strategy 2: Communicating via I/O with Ports
Learn how to communicate with external software using ports.
We'll cover the following...
Ports provide a safer alternative to integrate with external software. Each port starts the third-party software as a separate process in the operating system. If that port terminates, the Elixir code gets a message, and we can act accordingly. A segmentation fault in the external port won’t bring the Elixir system down.
It is possible that we’ve already spawned ports in our Elixir applications, like this:
System.cmd("elixir", ["-e", "IO.puts 21 * 2"])
Now, try running this in the terminal below.
Please click the “Click to Connect” at the center of the ...
Ask