From 65f957695efc19756a6a9b581e5eed53d67c3708 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Tue, 10 Aug 2021 21:32:13 +1200 Subject: [PATCH] vncserver: extract DeleteLogLeftFromPreviousXvncRun() --- unix/vncserver | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index 0ae9f79..43d4e15 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -32,6 +32,8 @@ &ParseAndProcessCliOptions(); $vncPort = 5900 + $displayNumber; $desktopName = $opt{'-name'} || "$host:$displayNumber ($ENV{USER})"; +$desktopLog = "$vncUserDir/$host:$displayNumber.log"; +$pidFile = "$vncUserDir/$host:$displayNumber.pid"; &CreateDotVncDir(); @@ -46,16 +48,13 @@ if ($kasmAuthEnabled && !&AtLeastOneUserConfigured()) { @kasmPasswdUsers = &LoadKasmPasswdUsers(); } -$desktopLog = "$vncUserDir/$host:$displayNumber.log"; -unlink($desktopLog); - &SetupXauthorityFile(); # Now start the X VNC Server $cmd = &ConstructXvncCmd(); -$pidFile = "$vncUserDir/$host:$displayNumber.pid"; +&DeleteLogLeftFromPreviousXvncRun(); &StartXvncAndRecordPID(); &WaitForXvncToStart(); @@ -926,6 +925,10 @@ sub StartXvncAndRecordPID { system("$cmd & echo \$! >$pidFile"); } +sub DeleteLogLeftFromPreviousXvncRun { + unlink($desktopLog); +} + sub StartXvncWithSafeFontPath { if ($fpArgSpecified) { warn "\nWARNING: The first attempt to start Xvnc failed, probably because the font\n";