ts <decoux / moulon.inra.fr> writes: > >>>>> "D" == Dave Thomas <Dave / thomases.com> writes: > > D> D'accord! But I'm wondering why it is. The semantics of the open have > D> it returning a result to both the parent and the child. It can't do > D> that without executing the block, so shouldn't it be running the block > D> in both places? > > i.e. make a special case for - ? Actually, I'd say that |<cmd> is the special case. The normal action of 'open' is to return the File, either as a result or to the block. If you use f = open("|-") or f = open("|stuff") the semantic is continued - it returns the File (or nil), both to the child and to the parent. So, continuing the theme open("|-") { |f| ... } should be no different - it should give the block the File in the parent and nil in the child. But... I can see the argument the other way, that the block should only be executed in the parent (the current behavior). In terms of explaining what's going on, the current behavior is probably easier too. It just surprised me when it happened. Regards Dave