From 8ca36e349efcda32012332a4629e42367b1f3b34 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 10 Aug 2021 22:21:52 +1200 Subject: [PATCH] vncserver: extract StartXvncOrExit() --- unix/vncserver | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index d3f63a7..89c48f4 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -49,22 +49,7 @@ if ($kasmAuthEnabled) { &SetupXauthorityFile(); -# Now start the X VNC Server - -$cmd = &ConstructXvncCmd(); - -&DeleteLogLeftFromPreviousXvncRun(); -&StartXvncAndRecordPID(); -&WaitForXvncToRespond(); - -if (!&IsXvncRunning() && !&UsingSafeFontPath()) { - &StartXvncWithSafeFontPath(); - &WaitForXvncToRespond(); -} - -unless (&IsXvncRunning()) { - &WarnUserXvncNotStartedAndExit(); -} +&StartXvncOrExit(); warn "\nNew '$desktopName' desktop is $host:$displayNumber\n"; &PrintKasmUsers(); @@ -1067,3 +1052,20 @@ sub EnsureAtLeastOneKasmUserExists { @kasmPasswdUsers = &LoadKasmPasswdUsers(); } } + +sub StartXvncOrExit { + $cmd = &ConstructXvncCmd(); + + &DeleteLogLeftFromPreviousXvncRun(); + &StartXvncAndRecordPID(); + &WaitForXvncToRespond(); + + if (!&IsXvncRunning() && !&UsingSafeFontPath()) { + &StartXvncWithSafeFontPath(); + &WaitForXvncToRespond(); + } + + unless (&IsXvncRunning()) { + &WarnUserXvncNotStartedAndExit(); + } +}