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

Re: zpty -r and pipes



On Mon, May 13, 2013 at 8:27 AM, Stephane Chazelas
<stephane.chazelas@xxxxxxxxx> wrote:
>
> $ zsh -c 'zmodload zsh/zpty; zpty E echo test; zpty -r E | cat'
> $
>
> No output.

Check the exit status:

% zsh -c 'zmodload zsh/zpty; zpty E echo test; zpty -r E | cat &&
print $pipestatus'
1 0
%

"zpty -r" is failing.  I wonder if this is another case of a read()
being interrupted by a signal?  It seems to be a race, I can affect it
by inserting a sleep:

% zsh -c 'zmodload zsh/zpty; zpty E echo test; (zpty -r E) | cat'
test
% zsh -c 'zmodload zsh/zpty; zpty E echo test; {sleep 1; zpty -r E} | cat'
% zsh -c 'zmodload zsh/zpty; zpty E echo test; {zpty -r E; sleep 1} | cat'
test



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