git clone https://git.lucas.co/fontpreview.git
Use pgrep instead of procfs to check if program is running
Procfs might not available on every platform. pgrep is much more
portable.
fontpreview | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fontpreview b/fontpreview
index 70eda23..22aaf53 100755
--- a/fontpreview
+++ b/fontpreview
@@ -120,8 +120,7 @@ main(){
# Check for crashes of sxvi
elif [[ -f $PIDFILE ]] ; then
- PID=$(cat $PIDFILE)
- if [[ ! -e /proc/$PID ]] ; then
+ if ! pgrep -F "$PIDFILE"; then
echo "Restart sxvi - You maybe using a obsolete version. " >&2
# Display the font preview using sxiv
sxiv -g "$SIZE$POSITION" -N "fontpreview" -b "$FONT_PREVIEW" &