delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40 |
X-Spam-Check-By: | sourceware.org |
MIME-Version: | 1.0 |
In-Reply-To: | <416096c61002261229j31f92387u8b8e3e9b716cb131@mail.gmail.com> |
References: | <201002261446 DOT o1QEki2k024924 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <416096c61002261229j31f92387u8b8e3e9b716cb131 AT mail DOT gmail DOT com> |
Date: | Sat, 6 Mar 2010 06:21:20 +0000 |
Message-ID: | <416096c61003052221w3ea03a88wd3d1e00c4e40b016@mail.gmail.com> |
Subject: | Re: terminals getting killed on parent's termination |
From: | Andy Koppe <andy DOT koppe AT gmail DOT com> |
To: | cygwin AT cygwin DOT com |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Andy Koppe: > 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 th= is: >> >> 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. = Exit 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 SIGHUP in these cases. Ah, it's due to a bash option: huponexit, which is off by default. When bash receives a SIGHUP, e.g. due to the terminal's close button being pressed, it always forwards that to its children (apart from those that have been disowned). But when exiting bash, it only sends SIGHUP if huponexit is set. Bash's children don't directly receive SIGHUPs from the terminal, because each is placed into a separate process group. 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |