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 17:34:06 +0000, Stephane Chazelas:
[...]
> That means, that one can't ^C
> 
> sleep 1 | cat $(sleep 10)
> 
> for instance.
[...]

For the record, while

/bin/sleep 1 | cat $(/bin/sleep 10) | cat

can be interrupted in ksh93,

ksh93$ /bin/sleep 1 | cat $(ps -jf>&2) $(/bin/sleep 20)
UID        PID  PPID  PGID   SID  C STIME TTY          TIME CMD
chazelas 16259  5079 16259 16259  0 10:58 pts/7    00:00:00 /bin/zsh
chazelas 16281 16259 16281 16259  0 10:59 pts/7    00:00:00 ksh93 -o emacs
chazelas 16355 16281 16355 16259  0 11:02 pts/7    00:00:00 /bin/sleep 1
chazelas 16356 16281 16281 16259  0 11:02 pts/7    00:00:00 ps -jf
chazelas 16357 16281 16281 16259  0 11:02 pts/7    00:00:00 /bin/sleep 20

Cannot (see how ps -j and sleep 20 run (concurrently!) in a
different process group from sleep 1) like in zsh (and a ^Z
while sleep 1 is running causes a deadlock).

One difference with zsh is that it can't be worked around by
running that last pipe component in a subshell (as ksh93 fakes
subshells instead of forking).

-- 
Stephane



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