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

On Mar 23, 10:05pm, Joey Pabalinas wrote:
} > It could be I just haven't constructed the right test.
} It's kind of an *incredibly* unlikely edge-case but FWIW:
} > $ echo | ps -j $(: $(cat)) | cat | cat | cat
} The shell _seems_ to completely lock up after applying your patch; on
} my zsh 5.4.2 release version there are no problems (aside from the
} original process group leader issues).

Hmm.  The parent shell has received a SIGTTIN signal during readoutput()
even though the descriptor from which it is reading is not a TTY.

This is because the tty process group is still that of the deceased job
leader, and $(cat) is in the new process group owned by the parent, so
when $(cat) is stopped the process group stops as well.

The parent needs to reattach to the terminal when reaping the group
leader, so that $(cat) doesn't get SIGTTYIN and so that the parent
begins receiving tty interrupts etc. again.

I'm not yet sure exactly where that should happen.

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