stumpish: Fix search for stumpwm PID if launched as stumpwm child process.

FreeBSD specific fix. In the FreeBSD the pgrep didn't list processes,
which are ancestors of pgrep even if they are matched with given
string. So, if stumpish was launched from the stumpwm itself, then it
couldn't find PID of stumpwm process.

This fix uses pgrep with '-a' key, which enable showing even the
ancestors of pgrep in the it's output.
This commit is contained in:
eugeneandrienko 2025-07-27 17:18:20 +03:00
parent 1e3fa7abae
commit 495d6e941e
No known key found for this signature in database
GPG key ID: 713D984F56881209

View file

@ -40,7 +40,9 @@ fi
stumpwm_pid ()
{
if command -v pgrep 2>&1 >/dev/null; then
if test $(uname -s) = "FreeBSD" && command -v pgrep 2>&1 > /dev/null; then
STUMPWM_PID=$(pgrep -a -u $(id -u) stumpwm)
elif command -v pgrep 2>&1 >/dev/null; then
STUMPWM_PID=$(pgrep -u $(id -u) stumpwm)
elif [ -d /proc ]; then
# Go up the process chain until we locate StumpWM's process using