From 7ee152214393ec0e468118aa7fa8bc9abfc0aa3b Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 2 Aug 2021 23:05:29 +1200 Subject: [PATCH] vncserver: extract WaitForXvncToStart() --- unix/vncserver | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index 0cc9b74..31780f2 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -112,9 +112,7 @@ $cmd = &ConstructXvncCmd(); # Run $cmd and record the process ID. $pidFile = "$vncUserDir/$host:$displayNumber.pid"; &StartXvncAndRecordPID(); - -# Give Xvnc a chance to start up -sleep(3); +&WaitForXvncToStart(); &IfXvncDidntStartTryFixingFontPathAndStartXvncAgain(); @@ -939,7 +937,7 @@ sub IfXvncDidntStartTryFixingFontPathAndStartXvncAgain { $cmd =~ s@-fp [^ ]+@@; $cmd .= " -fp $defFontPath" if ($defFontPath); &StartXvncAndRecordPID(); - sleep(3); + &WaitForXvncToStart(); } } } @@ -956,3 +954,7 @@ sub WarnUserXvncNotStartedAndExit { close(LOG); die "\n"; } + +sub WaitForXvncToStart { + sleep(3); +}