From: DRC Date: Wed, 16 Mar 2011 19:32:02 +0000 (+0000) Subject: Don't pretend that vncserver -fg & works, because closing stdin causes problems with... X-Git-Tag: v1.0.90 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=608cfdeaa7ee9ace596c0d20af42c5b4ba7e4d8d;p=tigervnc.git Don't pretend that vncserver -fg & works, because closing stdin causes problems with some WM's. Instead, just revert to the original vncserver -fg code and add a separate option for auto-killing Xvnc when run in "background" mode. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/1_1@4361 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/unix/vncserver b/unix/vncserver index 7fe93bd1..689641f0 100755 --- a/unix/vncserver +++ b/unix/vncserver @@ -122,7 +122,7 @@ if ($fontPath eq "") { # Check command line options &ParseOptions("-geometry",1,"-depth",1,"-pixelformat",1,"-name",1,"-kill",1, - "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0,"-fg",0); + "-help",0,"-h",0,"--help",0,"-fp",1,"-list",0,"-fg",0,"-autokill",0); &Usage() if ($opt{'-help'} || $opt{'-h'} || $opt{'--help'}); @@ -338,10 +338,19 @@ if (-e "/tmp/.X11-unix/X$displayNumber" || $ENV{VNCDESKTOP}= $desktopName; if ($opt{'-fg'}) { - close(STDIN); - system("($vncUserDir/xstartup; $0 -kill :$displayNumber) >> " . "edString($desktopLog) . " 2>&1"); + system("$vncUserDir/xstartup >> " . "edString($desktopLog) . " 2>&1"); + if (kill 0, `cat $pidFile`) { + $opt{'-kill'} = ':'.$displayNumber; + &Kill(); + } } else { - system("$vncUserDir/xstartup >> " . "edString($desktopLog) . " 2>&1 &"); + if ($opt{'-autokill'}) { + system("($vncUserDir/xstartup; $0 -kill :$displayNumber) >> " + . "edString($desktopLog) . " 2>&1 &"); + } else { + system("$vncUserDir/xstartup >> " . "edString($desktopLog) + . " 2>&1 &"); + } } exit; @@ -564,6 +573,7 @@ sub Usage " [-pixelformat rgbNNN|bgrNNN]\n". " [-fp ]\n". " [-fg]\n". + " [-autokill]\n". " ...\n\n". " $prog -kill \n\n". " $prog -list\n\n"); diff --git a/unix/vncserver.man b/unix/vncserver.man index c24225ae..7654380e 100644 --- a/unix/vncserver.man +++ b/unix/vncserver.man @@ -15,6 +15,7 @@ vncserver \- start or stop a VNC server .RB [ \-fp .IR font-path ] .RB [ \-fg ] +.RB [ \-autokill ] .RI [ Xvnc-options... ] .br .BI "vncserver \-kill :" display# @@ -113,6 +114,12 @@ can be aborted with CTRL-C, and (2) the VNC server will exit as soon as the user logs out of the window manager in the VNC session. This may be necessary when launching TigerVNC from within certain grid computing environments. +.TP +.B \-autokill +Automatically kill Xvnc whenever the xstartup script exits. In most cases, +this has the effect of terminating Xvnc when the user logs out of the window +manager. + .SH FILES Several VNC-related files are found in the directory $HOME/.vnc: .TP