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

Re: PATCH (?): Re: suspend while loop.



On May 19,  9:43am, Sven Wischnowsky wrote:
} Subject: Re: PATCH (?): Re: suspend while loop.
}
} Bart Schaefer wrote:
} 
} > The thing that most worries me is that zread() can invoke zle, which can
} > invoke shell functions, which ....
} 
} No, it only uses getkey() which doesn't call functions. It's just a
} read-one-char that works while zle is active. But it should be
} possible to avoid the child_unblock() when `izle != 0', I think.

I don't think that's worth the effort and the messiness; `read' is going
to spend the vast majority of its time in the read-one-character loops,
so as long as the signal changes are outside those loops it should be OK.

BTW, I just noticed this:

	echo -n foo | read line
	echo $?
	echo $line

By comparison, bash also gives $? == 1 but NOT $line == foo.

(Why is lack of a trailing newline an error?)

} > Another question is, is there a more generic way to do this [...?]
} 
} We only have to handle builtins that can potentially block
} indefinitely, right?

Well ... there's the "command1 | builtin ; command2" thing where interrupt
kills command1 but not builtin, causing builtin to exit on EOF and thereby
allowing command2 to run.  Ideally the interrupt would affect command2 as
well.  If builtin is a loop or other construct this already works, so the
questions are (1) can any other builtins be used in a pipe, and (2) can
any syntactic construct other than a pipeline produce the same effect.

Given that modules can do just about anything they want, the answer to (1)
is "yes" even if there's currently no example ...

However, that doesn't affect 3.0.8, so I think I'm going to go ahead with
11461 for that release (unless somebody hollers today to stop me).

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



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