1 # NOTE: for the cleanups below, even if our shell is not the one that spawned
2 # the directory, SHLVL == 1 means that it should be safe to clean it up.
3 # since .zlogout isn't guaranteed to have been run in the same shell as
4 # our .zprofile was (since we source it in .zshenv) it has to be done
7 ### gpg forward cleanup
8 if [[ $SHLVL == 1 && $GNUPGHOME =~ '/.ssh_forward/\d+/*$' ]] {
11 [[ -o GLOB_ASSIGN ]]; y=$?
13 GNUPGHOME=$GNUPGHOME/../..(:a)
14 [[ $y != 0 ]] && unsetopt GLOB_ASSIGN
15 # clean dir if it exists
17 find $x -mindepth 1 -maxdepth 1 | while read -r y; do
20 rmdir -p $x 2>/dev/null
22 # clean up any remaining sockets from gpg forwarding
23 rm -f $_GNUPG_SOCK_DEST_BASE*(N=)
26 ### remove tmp runtime if our shell spawned it
27 if [[ $SHLVL == 1 && $TMPDIR =~ '/.session.\d+/*$' ]] {
28 rm -rf $TMPDIR 2>/dev/null
31 if [[ -o interactive ]] {
36 ### load site-specific
37 if [[ -f ~/.zlogout.local ]] { source ~/.zlogout.local }
39 # vim: et sts=4 sw=4 ts=8 tw=79