X-Git-Url: https://git.sev.monster/~sev/dotfiles.git/blobdiff_plain/1ef46e010e2dc017f60cddfabf6e669a0469ef3f..833b2af31c59941e1bdfed4f67d70cf20a40d2a9:/base/.zlogout?ds=inline diff --git a/base/.zlogout b/base/.zlogout index 3b09ce5..6e7b474 100644 --- a/base/.zlogout +++ b/base/.zlogout @@ -1,5 +1,11 @@ -# gpg forward cleanup -if [[ $SHLVL == 1 && $GNUPGHOME =~ '.ssh_forward/\d+$' ]] { +# NOTE: for the cleanups below, even if our shell is not the one that spawned +# the directory, SHLVL == 1 means that it should be safe to clean it up. +# since .zlogout isn't guaranteed to have been run in the same shell as +# our .zprofile was (since we source it in .zshenv) it has to be done +# like this. + +### gpg forward cleanup +if [[ $SHLVL == 1 && $GNUPGHOME =~ '/.ssh_forward/\d+/*$' ]] { x=$GNUPGHOME # reset GNUPGHOME [[ -o GLOB_ASSIGN ]]; y=$? @@ -17,10 +23,17 @@ if [[ $SHLVL == 1 && $GNUPGHOME =~ '.ssh_forward/\d+$' ]] { rm -f $_GNUPG_SOCK_DEST_BASE*(N=) } -[[ -o interactive ]] && echo logout -clear +### remove tmp runtime if our shell spawned it +if [[ $SHLVL == 1 && $TMPDIR =~ '/.session.\d+/*$' ]] { + rm -rf $TMPDIR 2>/dev/null +} + +if [[ -o interactive ]] { + echo logout + clear +} ### load site-specific if [[ -f ~/.zlogout.local ]] { source ~/.zlogout.local } -# vim: set et sts=4 sw=4 ts=8 tw=79 : +# vim: et sts=4 sw=4 ts=8 tw=79