From df5d3e506df76bc745d5c355bd018c20d0f05f79 Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Mon, 2 Aug 2021 00:27:11 +1200 Subject: [PATCH] vncserver: extract WarnUserXvncNotStartedAndExit() --- unix/vncserver | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index 91d6f53..0cc9b74 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -119,12 +119,7 @@ sleep(3); &IfXvncDidntStartTryFixingFontPathAndStartXvncAgain(); unless (&IsXvncRunning()) { - warn "Could not start Xvnc.\n\n"; - unlink $pidFile; - open(LOG, "<$desktopLog"); - while () { print; } - close(LOG); - die "\n"; + &WarnUserXvncNotStartedAndExit(); } warn "\nNew '$desktopName' desktop is $host:$displayNumber\n"; @@ -952,3 +947,12 @@ sub IfXvncDidntStartTryFixingFontPathAndStartXvncAgain { sub IsXvncRunning { kill 0, `cat $pidFile`; } + +sub WarnUserXvncNotStartedAndExit { + warn "Could not start Xvnc.\n\n"; + unlink $pidFile; + open(LOG, "<$desktopLog"); + while () { print; } + close(LOG); + die "\n"; +}