Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: logout from interactive subshell
- X-seq: zsh-users 10854
- From: Vincent Lefevre <vincent@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: logout from interactive subshell
- Date: Fri, 13 Oct 2006 00:24:59 +0200
- In-reply-to: <061012075850.ZM19537@xxxxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <237967ef0610120210r1d3a8c57n8850a4872b846c77@xxxxxxxxxxxxxx> <F7507090F1A72B43A51444325DFBE43101391E41@xxxxxxxxxxxxxxxxxxxxxxxxxx> <87ac41c0eo.fsf@xxxxxxxxxx> <061012075850.ZM19537@xxxxxxxxxxxxxxxxxxxxxx>
On 2006-10-12 07:58:50 -0700, Bart Schaefer wrote:
> ----
> # This goes in ~/.zshrc for all interactive shells:
> trap logout USR1
>
> if [[ ${LOGINPID:-$$} != $$ ]]
> then
> function logout { kill -USR1 $PPID; exit }
> fi
> ----
You need to check that the parent process is an interactive zsh shell
since one can run a zsh login shell and a command in it that would
run an interactive zsh. I can see at least two cases where this can
happen:
1. With a text-mode login, then startx, then terminals with a zsh in
them.
2. With screen.
So, I suggest the following:
trap logout USR1
[[ $MYPID == $PPID ]] && logout() { kill -USR1 $PPID; exit }
export MYPID=$$
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author