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

Re: PATCH: functions with redirections



On Sep 29, 2014 12:52 PM, "Peter Stephenson" <p.w.stephenson@xxxxxxxxxxxx>
wrote:
>
> This seems to add the ability to define functions with redirections that
> take effect when the function is run.  Parsing didn't actually need
> changing at all, despite what I said a few days ago --- we already parse
> the redirections, it's just a question of saving them at the definition
> and digging them back out when executing.

Pardon me for asking when I haven't had a chance to try it yet, but does
this work right if redirection of the same FD appears both at the time of
def'n and at the time of call?

E.g. in bash:

foo() { echo foo; } >&3
foo 3>&2

first dups 3 from 2 and then dups 1 from 3, so "foo" is echo'd to stderr.

> I haven't yet looked at dump files.  That's partly becuase I don't
> understand them and partly because I don't use them.  Any hints would be
> great.

By dump files do you mean zcompile?
I fear I'm not of much help there.

> If anyone wants something else to do they can think about whether I've
> introduced any subtle memory leaks.

I wouldn't expect any that would fool valgrind on a few simple examples.


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