I need to monitor an external OS process and know when it exits. In other words, if I were in C, I’d use waitpid. (Unfortunately, google results are generally overwhelmed with articles about Erlang processes, not relevant to OS processes.) Some other details:
- I’m not launching the process from Elixir
- I’m not monitoring its stdout or stderr
- I’m not sending data to it on stdin
Really, I have an OS pid, and all I want is to know immediately when that process exits. Is the way to do that to just System.cmd & a shell to wait?
Edit: shell won’t even work; it can only wait on its own children. Yeah, I’m remembering now–when I did this in C I did not use waitpid, I used kqueue…