vncserver: extract IsXvncRunning()

This commit is contained in:
Dmitry Maksyoma 2021-08-01 22:46:12 +12:00
parent 84764bac80
commit 7954cc506c

View File

@ -118,7 +118,7 @@ sleep(3);
&IfXvncDidntStartTryFixingFontPathAndStartXvncAgain(); &IfXvncDidntStartTryFixingFontPathAndStartXvncAgain();
unless (kill 0, `cat $pidFile`) { unless (&IsXvncRunning()) {
warn "Could not start Xvnc.\n\n"; warn "Could not start Xvnc.\n\n";
unlink $pidFile; unlink $pidFile;
open(LOG, "<$desktopLog"); open(LOG, "<$desktopLog");
@ -930,7 +930,7 @@ sub StartXvncAndRecordPID {
sub IfXvncDidntStartTryFixingFontPathAndStartXvncAgain { sub IfXvncDidntStartTryFixingFontPathAndStartXvncAgain {
if ($fontPath ne $defFontPath) { if ($fontPath ne $defFontPath) {
unless (kill 0, `cat $pidFile`) { unless (&IsXvncRunning()) {
if ($fpArgSpecified) { if ($fpArgSpecified) {
warn "\nWARNING: The first attempt to start Xvnc failed, probably because the font\n"; 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"; 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`;
}