So I wanted to launch and control the venerable ping program from inside Elixir code.
I’ve quickly realised the the erlang Ports are really limited in what they can do (can’t send signals, no notification if the remote process exited); they were designed with “custom programs” in mind, and not to just launch any external OS process.
Any libraries I’ve found, like Porcelain or erlexec, rely on “shim” programs to do more advanced control.
Is there really no other low-level way in Erlang to launch & control external OS processes without having to rely on external dependencies? Is that a design decision?
I thought of that but ICMP traffic in particular is “sensitive” in some OSes, you may need special permissions to send/receive it. The ping executable OTOH is always in the “allowlist”
Yes, sending signals like SIGINT, SIGTERM, SIGKILL and others. Shelling out to kill does work but if feels a bit like a kludge (and it’s not cross-platform, even though currently I don’t really care).