<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">macOS does not have the "pwait" command that Linux and some other Unix versions have, which allows waiting on any process (not just a child), given the PID. There would definitely be uses for that, like dealing with a process that backgrounds itself when you wish it didn't, provided you have some way (if it writes a PID file, or if there would only be one instance, using pgrep) to get the PID of the backgrounded process.<div class=""><br class=""></div><div class="">Turns out FreeBSD has an implementation that uses the kqueue mechanism, which macOS has.</div><div class=""><br class=""></div><div class=""><a href="https://github.com/freebsd/freebsd-src/tree/master/bin/pwait" class="">https://github.com/freebsd/freebsd-src/tree/master/bin/pwait</a></div><div class=""><br class=""></div><div class="">The Makefile there is useless unless building as part of FreeBSD, but one can just</div><div class=""><br class=""></div><div class="">cc pwait.c -o pwait</div><div class=""><br class=""></div><div class="">and it will compile and work just fine. There's also a man page in the previously mentioned location.</div><div class=""><br class=""></div><div class="">Wishing for a port...bit ugly when you can't use the supplied Makefile. Sadly, not volunteering myself. :-/</div><div class=""><br class=""></div><div class="">Given a trick in altering the URL a bit (replace tree/master with trunk), one can fetch just that directory rather than the whole FreeBSD tree:</div><div class=""><br class=""></div><div class="">svn co <a href="https://github.com/freebsd/freebsd-src/trunk/bin/pwait" class="">https://github.com/freebsd/freebsd-src/trunk/bin/pwait</a></div><div class=""><br class=""></div></body></html>