* zpty -r and pipes
@ 2013-05-13 15:27 Stephane Chazelas
2013-05-13 16:21 ` Peter Stephenson
2013-05-14 1:25 ` Bart Schaefer
0 siblings, 2 replies; 3+ messages in thread
From: Stephane Chazelas @ 2013-05-13 15:27 UTC (permalink / raw)
To: zsh-workers
$ zsh -c 'zmodload zsh/zpty; zpty E echo test; zpty -r E'
test
But if I pipe it to anything:
$ zsh -c 'zmodload zsh/zpty; zpty E echo test; zpty -r E | cat'
$
No output.
Those are fine though:
$ zsh -c 'zmodload zsh/zpty; zpty E echo test; echo $(zpty -r E)'
test
$ zsh -c 'zmodload zsh/zpty; zpty E echo test; {zpty -r E} | cat'
test
Sounds like some bug in fd management.
$ zsh --version
zsh 5.0.2 (x86_64-unknown-linux-gnu)
--
Stephane
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: zpty -r and pipes
2013-05-13 15:27 zpty -r and pipes Stephane Chazelas
@ 2013-05-13 16:21 ` Peter Stephenson
2013-05-14 1:25 ` Bart Schaefer
1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2013-05-13 16:21 UTC (permalink / raw)
To: Zsh Hackers' List
On Mon, 13 May 2013 16:27:20 +0100
Stephane Chazelas <stephane.chazelas@gmail.com> wrote:
> $ zsh -c 'zmodload zsh/zpty; zpty E echo test; zpty -r E'
> test
>
> But if I pipe it to anything:
>
> $ zsh -c 'zmodload zsh/zpty; zpty E echo test; zpty -r E | cat'
> $
>
> No output.
>
> Those are fine though:
>
> $ zsh -c 'zmodload zsh/zpty; zpty E echo test; echo $(zpty -r E)'
> test
> $ zsh -c 'zmodload zsh/zpty; zpty E echo test; {zpty -r E} | cat'
> test
First guess and without looking into it is it might be a job control
thing. Those look just the circumstances where we wouldn't have a
special job in a subshell (pipeline) or where we would (command
substitution, new current-shell process before the fork).
But I could just be wasting typing time.
Not sure what this has got to do with file descriptors anyway.
pws
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: zpty -r and pipes
2013-05-13 15:27 zpty -r and pipes Stephane Chazelas
2013-05-13 16:21 ` Peter Stephenson
@ 2013-05-14 1:25 ` Bart Schaefer
1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2013-05-14 1:25 UTC (permalink / raw)
To: Zsh hackers list
On Mon, May 13, 2013 at 8:27 AM, Stephane Chazelas
<stephane.chazelas@gmail.com> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-05-14 1:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-13 15:27 zpty -r and pipes Stephane Chazelas
2013-05-13 16:21 ` Peter Stephenson
2013-05-14 1:25 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).