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

Re: PATCH: test for trap EXIT fix.



On Oct 2,  4:32pm, Peter Stephenson wrote:
}
} Bart Schaefer wrote:
} > I'm having a hard time grokking "top level EXIT trap" in that context,
} 
} `Top level' means whatever's on the front of the list of EXIT traps.

Ah.  I'd have said

	trap 'print top-level' EXIT
	fn() {
	  trap 'print fn-level' EXIT
	  ( trap 'print subshell' EXIT )
	}

and in that sense the subshell can't possibly execute the top-level trap.
At the same time, but in another sense, `fn-level' and `subshell' are at
the same "level" there.

} The 4.0 behaviour is that only the explicit exit produces a trap; falling
} off the end of the subshell in `( true )' doesn't.  I would guess this is
} wrong and they should be equivalent.  That may require more special
} handling.

Hrm.

zagzig% echo $ZSH_VERSION
3.0.8
zagzig% TRAPEXIT() { print exiting }
zagzig% (true)
zagzig% (exit)
exiting
zagzig% fn() { ( true ) ; ( exit ); }
zagzig% fn
zagzig% exit
exiting


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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