X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 X-Spam-Check-By: sourceware.org MIME-Version: 1.0 In-Reply-To: <201002261446.o1QEki2k024924@mail.bln1.bf.nsn-intra.net> References: <201002261446 DOT o1QEki2k024924 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> Date: Fri, 26 Feb 2010 20:29:37 +0000 Message-ID: <416096c61002261229j31f92387u8b8e3e9b716cb131@mail.gmail.com> Subject: Re: terminals getting killed on parent's termination From: Andy Koppe To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Thomas Wolff wrote: > In general, a GUI application started in the background, like a terminal, > should detach itself from its parent process so that it survives if the > parent is terminated. Says who? You can always invoke it with setsid or some such to detach it. > I've noticed the following sometimes surprising inconsistencies about thi= s: > > mintty > =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm & > =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty & > =C2=A0 =C2=A0 =C2=A0 =C2=A0Close/Alt-F4 > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> dialog "Processes are running in session. E= xit anyway?" > =C2=A0 =C2=A0 =C2=A0 =C2=A0OK > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> xterm remains > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> mintty is killed > xterm > =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm & > =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty & > =C2=A0 =C2=A0 =C2=A0 =C2=A0Close/Quit > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> xterm remains > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> mintty is killed Mintty has default handling for SIGHUP, i.e. it exits. Same for rxvt. Xterm presumably chooses to ignore it. > mintty > =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm & > =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty & > =C2=A0 =C2=A0 =C2=A0 =C2=A0exit > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> all child terminals remain > xterm > =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm & > =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty & > =C2=A0 =C2=A0 =C2=A0 =C2=A0exit > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> all child terminals remain I don't understand why there isn't a SIGUP in these cases. > cygwin console > =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm & > =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty & > =C2=A0 =C2=A0 =C2=A0 =C2=A0exit/Alt-F4 > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> console hangs It's not really hanging; it's just waiting for xterm to finish. Xterm is linked as a console subsystem program, which means at startup it attaches to its parent's console (or opens its own if there isn't one). Consoles stay open as long as there's at least one process attached to them. Mintty, meanwhile, is a GUI subsystem program, which means it doesn't attach to or open a console. > =C2=A0 =C2=A0 =C2=A0 =C2=A0Close > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> mintty remains > =C2=A0 =C2=A0 =C2=A0 =C2=A0-> xterm is killed When a console is closed, Windows kills all processes attached to it. > Also, mintty can be protected from being killed by spawning it with > (mintty&) > while xterm, spawned this way from a cygwin console, still gets killed. Yep, doing that doesn't break the console attachment. Andy -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple