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
- X-seq: zsh-workers 42522
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Joey Pabalinas <joeypabalinas@xxxxxxxxx>
- Subject: Re: "echo | ps -j $(:) | cat | cat | cat" runs components in different process groups
- Date: Sat, 24 Mar 2018 17:34:06 +0000
- Cc: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5mJ55/misuf2B4OQPrE69NTTdh5aNkr++T5M50AHZcU=; b=DN3iWYWJ3247yKH9SJxa3vkEj4b0oDa0XmeRWNS/3D3jKID+EM9zzmwL5wMzGmIQVL VTHNjET1nwHIjt2jqpQfI2m/z5EuTRq/1wedDMzNYdjpwLaZE3JB5i6XGBN+bHzAC9QJ P6trdanxvPBR/tvLlzXZbtFrtTMmG3CPaiQsbdQaADYHDSUtl5IRrPfvORNZsIlkKdn/ o4ym94D169J1DiOaQigy1oEO0MJOz0RZgZ/zXvH8NJeuyWYw35QoCT0u1ixMq3JEO+uG rTTRIUwuwAflShfeKpx5oJ2+SVX6VvCv8A5RzWjWpWdmQxBSOegPhzgCyS0E1bMpAJvK Ag2Q==
- In-reply-to: <20180324080514.txxyrb3qiztu4pqt@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Joey Pabalinas <joeypabalinas@xxxxxxxxx>, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20180323161612.GB4857@chaz.gmail.com> <180323163614.ZM10192@torch.brasslantern.com> <180323221959.ZM27569@torch.brasslantern.com> <20180324080514.txxyrb3qiztu4pqt@gmail.com>
2018-03-23 22:05:14 -1000, Joey Pabalinas:
[...]
> The "cat: -: Input/output error" and differing number of entries is kind
> interesting, although I would be lying if I said that I understood why.
[...]
Yes, I should have mentioned that the initial problem was that
some of the processes in that command line are not running in
foreground, are not in the foreground process group of the
terminal.
The initial problem at unix.stackexchange.com was on something
like
echo x | $(echo vipe) | cat
or
echo x | vipe $(:) | cat
And vipe (running an editor to edit the pipe) is suspended when
trying to read from the terminal while it's not in the
foreground process group of the terminal.
And:
echo x | ps -j $(:) | cat | cat | cat
shows that all those ps/cat processes running in different
process groups instead of just one process group as one would
expect.
Bart explained that it was because zsh uses the first spawned
process (here to run a builtin) for the process group, makes
that the foreground process group, but by the time it spawns the
other processes, that first process has already returned and has
been waited for so zsh can't make the other processes join the
foreground process group.
I think here, zsh should not wait for that process until all the
processes in the jobs have been started and joined the process
group if that's what from a now-zombie process.
From stracing mksh, it looks like that's what it does. Stracing
ksh93, I can't seem to make it have the first process end before
the other ones are started, I'm not sure why that is.
That in a | b $(c) | d
c is not run in the same process group as the rest is probably a
separate though related issue I'd say.
That means, that one can't ^C
sleep 1 | cat $(sleep 10)
for instance.
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author