This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Bash process remains after I close rxvt in certain ways
- From: Charles Wilson <cygwin at cwilson dot fastmail dot fm>
- To: cygwin at cygwin dot com
- Date: Wed, 06 Dec 2006 21:56:32 -0500
- Subject: Re: Bash process remains after I close rxvt in certain ways
- References: <ej7u2n$mgb$1@sea.gmane.org> <45586C29.4050805@byu.net> <45588A58.3080704@cwilson.fastmail.fm> <loom.20061113T161452-299@post.gmane.org> <20061113161012.GA6263@trixie.casa.cgf.cx> <457685E6.1050202@cwilson.fastmail.fm> <20061206115947.GN9829@calimero.vinschen.de>
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 <pid of rxvt>
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/