X-Recipient: archive-cygwin@delorie.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: <4B8BEACA.4010003@towo.net>
References: <201002261446.o1QEki2k024924@mail.bln1.bf.nsn-intra.net> 	 <416096c61002261229j31f92387u8b8e3e9b716cb131@mail.gmail.com> 	 <4B8BEACA.4010003@towo.net>
Date: Thu, 4 Mar 2010 07:49:28 +0000
Message-ID: <416096c61003032349h6f22d223v7aa03c07f4f27475@mail.gmail.com>
Subject: Re: terminals getting killed on parent's termination
From: Andy Koppe <andy.koppe@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Thomas Wolff:
> Andy Koppe:
>> Mintty has default handling for SIGHUP, i.e. it exits.
>
> Actually (another topic but related) mintty has a great feature here: it
> passed the SIGHUP to its client application and if that application catches
> and handles the SIGHUP, mintty does *not* exit.

I don't think that's true. See signal_thread() in child.c: if mintty
receives a SIGINT, SIGTERM, or SIGHUP, it sends a SIGHUP to the child
process to say that the terminal is disappearing and then exits
immediately.

(I'm not convinced that sending the SIGHUP manually should be
necessary actually, i.e. I'd have expected SIGHUP to automatically be
sent to attached processes when the master side of the pty is closed
due to mintty exiting. But I haven't got 'round to look into this
properly.)


> This enables an application
> to be embedded into mintty as a terminal container and implement some
> reasonable "Really exit?" behaviour with the option not to exit.
> I suspect though, that this feature might not be on purpose since the
> semantics of SIGHUP would be slightly tweaked here. Anyway, it's very
> useful, so I'd like to ask to please make it a defined feature to rely on

This conflicts with your request for mintty to ignore SIGHUP.

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

