git.lucas.co / fontpreview
git clone https://git.lucas.co/fontpreview.git

commit6d42ae4b729951fcfd42384070cec39a32d57fc1
parentcd051648ec
authorMateusz Piotrowski <[email protected]>
date2020-02-11 11:13
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" &