X-Spam-Check-By: sourceware.org Message-ID: <457782E0.80103@cwilson.fastmail.fm> Date: Wed, 06 Dec 2006 21:56:32 -0500 From: Charles Wilson User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Bash process remains after I close rxvt in certain ways References: <45586C29 DOT 4050805 AT byu DOT net> <45588A58 DOT 3080704 AT cwilson DOT fastmail DOT fm> <20061113161012 DOT GA6263 AT trixie DOT casa DOT cgf DOT cx> <457685E6 DOT 1050202 AT cwilson DOT fastmail DOT fm> <20061206115947 DOT GN9829 AT calimero DOT vinschen DOT de> In-Reply-To: <20061206115947.GN9829@calimero.vinschen.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Corinna Vinschen wrote: > So there's something missing in the picture here... What does happen in > rxvt when Alt-F4 is pressed. Nothing? rxvt-20050409-3 (e.g. the current version) behaves the same way in all three cases: kill -HUP alt-f4 when rxvt has the focus click on the 'x' button in the rxvt window in each case, the current version of rxvt exits but leaves behind a zombie bash shell (assuming bash was the target cmd processor). rxvt-20050409-4 (e.g. the test version now on the mirrors) also has a common behavior across all three cases, but that behavior is different than the behavior described above. The new rxvt exits and sighups the child (which obligingly goes ahead and dies; no zombies) in all three cases. -- Chuck P.S. Here's the relevant changes between -3 and -4: src/main.c @@ -155,6 +155,9 @@ rxvt_Exit_signal #ifdef DEBUG_CMD rxvt_print_error("signal %d", sig); #endif + // pass signal on to child cmd processor + rxvt_t *r = rxvt_get_r(); + kill(r->h->cmd_pid, sig); rxvt_clean_exit(); kill(getpid(), sig); } @@ -200,6 +203,8 @@ rxvt_clean_exit r->h->Input_Context = NULL; } #endif + // terminal is dying, tell child cmd processor + kill(r->h->cmd_pid, SIGHUP); } The first hunk is in the signal handler that the parent rxvt registers for SIGHUP, SIGINT, SIGQUIT, and SIGTERM -- and ensures that those signals are passed along to the child. The second hunk is in rxvt_clean_exit, which is explicitly called in some other fatal-error situations and is registered with atexit/on_exit. Note that because rxvt_Exit_signal handler calls rxvt_clean_exit, the child may get two HUPs, or (whatever rxvt_Exit_signal got) and a HUP -- or, if rxvt_clean_exit was called via another mechanism, then the child will get only a single HUP. It appears to work okay for me -- but I'll wait for comments on the test release before I promote it. -- Chuck -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/