On Dec 13, 2021, at 21:11, Richard L. Hamilton wrote:

> 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.
> 
> https://github.com/freebsd/freebsd-src/tree/master/bin/pwait
> 
> 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. :-/

Added! Thanks for the suggestion.

https://ports.macports.org/port/pwait

Reply via email to