From 7954cc506c8bac7e1c96a4c873c2aab89fab6c43 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sun, 1 Aug 2021 22:46:12 +1200 Subject: [PATCH] vncserver: extract IsXvncRunning() --- unix/vncserver | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index ebebe70..91d6f53 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -118,7 +118,7 @@ sleep(3); &IfXvncDidntStartTryFixingFontPathAndStartXvncAgain(); -unless (kill 0, `cat $pidFile`) { +unless (&IsXvncRunning()) { warn "Could not start Xvnc.\n\n"; unlink $pidFile; open(LOG, "<$desktopLog"); @@ -930,7 +930,7 @@ sub StartXvncAndRecordPID { sub IfXvncDidntStartTryFixingFontPathAndStartXvncAgain { if ($fontPath ne $defFontPath) { - unless (kill 0, `cat $pidFile`) { + unless (&IsXvncRunning()) { if ($fpArgSpecified) { warn "\nWARNING: The first attempt to start Xvnc failed, probably because the font\n"; warn "path you specified using the -fp argument is incorrect. Attempting to\n"; @@ -948,3 +948,7 @@ sub IfXvncDidntStartTryFixingFontPathAndStartXvncAgain { } } } + +sub IsXvncRunning { + kill 0, `cat $pidFile`; +}