delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/03/05/15:52:03

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: <4B8BEACA.4010003@towo.net>
References: <201002261446 DOT o1QEki2k024924 AT mail DOT bln1 DOT bf DOT nsn-intra DOT net> <416096c61002261229j31f92387u8b8e3e9b716cb131 AT mail DOT gmail DOT com> <4B8BEACA DOT 4010003 AT towo DOT net>
Date: Fri, 5 Mar 2010 20:51:43 +0000
Message-ID: <416096c61003051251k56e7fed6s9976b2d96bae69e7@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

Thomas Wolff:
>>> 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?
>
> Common practice in Unix/Linux/X environments.

I've finally got round to trying to confirm this on Linux, and the
results make me wonder what exactly you are basing this assertion on.
Out of the terminals I tried, xterm and urxvt ignored SIGHUP, whereas
rxvt, konsole, gnome-terminal, and lxterminal terminated. Among a
bunch of other GUI apps, only gvim ignored SIGHUP, whereas firefox,
gimp, abiword, konqueror and others all terminated.


> And user expectation that an
> interactive session (which may e.g. contain an editing session with unsaved
> changes...) should not be aborted by an unrelated event.

You do have a point there (which is why mintty has the warning when
it's closed with background processes running). Closing the terminal
that a program was started from is not a completely unrelated event,
though, and there might well be users that do expect everything to
quit in that case. In other words, you don't help your case by stating
opinion as fact and ignoring the other side of an argument.


> 2. Manual termination of a terminal with a window manager operation (like
> clicking the Close X button, selecting Close from the menu, pressing
> Alt-F4).
> In the case of a Windows application, this is a WM_CLOSE message being
> handled (not a HUP as I had assumed).
> If the direct child process of the terminal explicitly catches HUP, the
> terminal should not terminate. It should just send HUP to its child and then
> terminate only if the child terminates (overriding a "hold after command
> terminates" option in this case, so the option can be reset when handling
> this).

Here we go again.

My little survey showed that xterm is the only terminal that does
things that way; all the others notify the child and quit immediately.


> It also works with mintty but only once, due to the 'killed' flag in the
> function child_kill in child.c

Funnily enough, this was a deliberate design decision, i.e., a
compromise between the two approaches. Unlike rxvt et al., it does
allow an application to say bye and prompt about unsaved data. Yet
unlike with xterm, a misbehaving application won't stop the user from
closing the terminal, because guess who'd be blamed for that.


> Should I propose a patch?

Not much point, because the difficult bit here is design not implementation.

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019