From 1bea4d0a41b6adccee659b403ac4723c0cc07e3a Mon Sep 17 00:00:00 2001 From: Dmitry Maksyoma Date: Sun, 1 Aug 2021 22:23:51 +1200 Subject: [PATCH] vncserver: extract StartXAndRecordPID() --- unix/vncserver | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/vncserver b/unix/vncserver index b248cc3..6101d14 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -111,7 +111,7 @@ $cmd = &ConstructXvncCmd(); # Run $cmd and record the process ID. $pidFile = "$vncUserDir/$host:$displayNumber.pid"; -system("$cmd & echo \$! >$pidFile"); +&StartXAndRecordPID(); # Give Xvnc a chance to start up @@ -130,7 +130,7 @@ if ($fontPath ne $defFontPath) { } $cmd =~ s@-fp [^ ]+@@; $cmd .= " -fp $defFontPath" if ($defFontPath); - system("$cmd & echo \$! >$pidFile"); + &StartXAndRecordPID(); sleep(3); } } @@ -939,3 +939,7 @@ sub ConstructXvncCmd { return $cmd; } + +sub StartXAndRecordPID { + system("$cmd & echo \$! >$pidFile"); +}