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

Re: PATCH: emulate (Re: Prompt fun)



Bart Schaefer wrote:
>Hmm.  I tend to think of it exactly the opposite way -- if I set errexit,
>I generally want it to continue to apply down through functions I call,
>because of exactly the circumstances you note -- scripts run from make,
>which uses -e when it invokes the shell.

Hmm.  Surely in that case, the functions in question are going to be ones
written to be executed in the context of that particular script, and
will be intended to have ERR_EXIT set, and won't have an emulate line?
emulate will be used in functions intended to be used in many places,
and these functions should indicate errors by themselves returning with
a non-zero status, which will come under the purview of the caller's
ERR_EXIT setting.  I've often written code like

	# I don't care if foo doesn't exist, so ignore the return code
	mv -f foo bar

which, if it were in a generic function, shoud have "emulate -L zsh",
and would be broken by ERR_EXIT being set unexpectedly.

-zefram



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