Skip to content

Commit 63b62c6

Browse files
committed
Make stumpish work on OpenBSD again
This fixes regression which was introduced by #296
1 parent 7f0bc88 commit 63b62c6

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

util/stumpish/stumpish

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,25 @@ stumpwm_pid ()
5151
echo "a bug in stumpish, please report it." 1>&2
5252
echo 1>&2
5353
exit 1
54-
elif [ "$(cat /proc/${pid}/comm)" = "stumpwm" ]
54+
elif [ -e "/proc/${pid}/comm" -a "$(cat /proc/${pid}/comm 2>/dev/null)" = "stumpwm" ]
5555
then
5656
STUMPWM_PID=$pid
5757
break
58-
else
58+
elif [ -n "$(which pgrep 2>/dev/null)" ]
59+
then
60+
pid=$(pgrep stumpwm)
61+
if [ -n $pid ]
62+
then
63+
STUMPWM_PID=$pid
64+
break
65+
else
66+
pid=1
67+
fi
68+
elif [ -e /proc/$pid/stat ]
69+
then
5970
pid=$(cut -f 4 -d " " < /proc/$pid/stat)
71+
else
72+
pid=1
6073
fi
6174
done
6275
}

0 commit comments

Comments
 (0)