Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

TRAPZERR() in chpwd()



On Sat, Apr 29, 2000 at 04:42:20AM +0000, Bart Schaefer wrote:
> On Apr 28,  4:15pm, Paul Ackersviller wrote:
> }
> } I guess it's intentional now that all tests which fail in chpwd() cause
> } TRAPZERR() to be executed.
> 
> Why do you guess that?  It's certainly a surprise to me.  Could you give
> a more specific example of what you mean, though?  TRAPZERR() is called
> any time any command exits with a nonzero status, in chpwd or anywhere
> else, and as far as I can tell it always has.

Yes, I know all that; what I meant by `tests' was internal shell tests as
opposed to external programs or other commands.  Here's a simplified example
of what I'm seeing.
	TRAPZERR () { echo exit code $?; }
	chpwd () { [ -h $PWD ] && echo symlink; true; }
When I change to a directory that's not a soft link, I'm getting the `exit
code' message from 3.1.7-pre-1, whereas I never have with earlier versions.
I'm just wondering which way is correct, or are all versions correct and I'm
just missing out on understanding something else that's related?

> There is a bug in unsetting TRAPxxx (as opposed to resetting them to
> something else) when localtraps is set.  You might try `trap - ZERR' or
> `disable -f TRAPZERR' instead for now.

Thanks, `trap - ZERR' is really what I meant to do all along, i.e. affect
only local behaviour inside the function, not global.

-- 
Paul Ackersviller



Messages sorted by: Reverse Date, Date, Thread, Author