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

Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups



2018-03-24 15:23:57 -0700, Bart Schaefer:
[...]
> Zsh would have to block "echo" from *starting*
> until the rest of the pipeline was built.

Note that it looks as if that's what ksh93 is doing, because
looking at strace -f, and even if I add a hundred |cat, echo's
write() is only done after all the processes have been started.

As I said earlier, while looking at strace output, I don't
understand how that works. Unless I'm missing something, it's as
if it was not done with syscalls. But then what could it be?
Busy loop on shared memory? One would have to look at the code I
suppose.

Note that with ksh93, like in other shells, one can't delay the
creation of the other processes with command substitutions as
they are not done in the main process.

I suppose pipes could be used. Is it not what zsh already does
in other contexts?

-- 
Stephane



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