Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: problem with 'ls | less' shell function
On Wed, Oct 19, 2022 at 1:28 AM <zsugabubus@national.shitposting.agency> wrote:
>
> I think what happens is that zsh fails to correctly set the foreground
> process group in `fg`. `less` is not in the foreground pgrp that's why
> it immediately gets suspended by SIGTTIN after it receives SIGCONT.
First sentence partly wrong, second sentence right.
When a shell function is suspended with ^Z, the parent shell forks
again to create a process for the shell function, but doesn't change
the process group of the pipeline. When "fg" brings the shell
function process back, that process is made group leader, but it then
needs to reset the group leader again to the pid of its own foreground
job, which it does not ... or, conversely, upon suspend the parent
shell needs to avoid changing the group leader of the new process.
At this point I'm not sure which of those needs to happen or where.
It's all in or around the call to addproc() at exec.c line 1734.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author