Richard L. Hamilton
rlhamil at smart.net
Tue Dec 14 03:11:56 UTC 2021
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.
Turns out FreeBSD has an implementation that uses the kqueue mechanism, which macOS has.
The Makefile there is useless unless building as part of FreeBSD, but one can just
cc pwait.c -o pwait
and it will compile and work just fine. There's also a man page in the previously mentioned location.
Wishing for a port...bit ugly when you can't use the supplied Makefile. Sadly, not volunteering myself. :-/
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:
svn co https://github.com/freebsd/freebsd-src/trunk/bin/pwait <https://github.com/freebsd/freebsd-src/trunk/bin/pwait>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the macports-users