Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Bug] Unexpected process suspension
- X-seq: zsh-workers 45825
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: [Bug] Unexpected process suspension
- Date: Wed, 13 May 2020 07:29:02 +0100
- Cc: Rudi C <rudiwillalwaysloveyou@xxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- In-reply-to: <CAH+w=7Zb_zaasw4NSVRt4kznqWEyr17TFqf6N5=7yhBTefH5Dw@mail.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: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Rudi C <rudiwillalwaysloveyou@xxxxxxxxx>, "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAE9z9A3CM6A1AdprdABLoPo_vfPKEnt5+3yLVT7hUbcQYUhT2Q@mail.gmail.com> <CAH+w=7Zb_zaasw4NSVRt4kznqWEyr17TFqf6N5=7yhBTefH5Dw@mail.gmail.com>
2020-05-12 10:38:38 -0700, Bart Schaefer:
> On Tue, May 12, 2020 at 12:03 AM Rudi C <rudiwillalwaysloveyou@xxxxxxxxx> wrote:
> >
> > mdoc-test () {
> >
> > sleep 0 | sleep 0
> > cat}
> >
> > echo start |VISUAL=vim command vipe|mdoc-test
> >
> > # zsh: suspended (tty output)
>
> Putting an interactive command in the middle of a pipeline is
> generally not going to work. Vim in particular is pretty aggressive
> about trying to grab a terminal, which will result in processes
> getting SIGTT* because they don't have foreground control of the
> terminal they're trying to use.
[...]
The thing is vim *should* be in the foreground, all the
processes started in pipeline should be in the same process
group which should be in foreground (so it gets
SIGINT/SIGQUIT/SIGTSTP upon ^C/^\/^Z, so it can read the
terminal, etc) but under some circumstances, zsh fails to put
some processes in that group, which is a bug.
$ </proc/self/stat awk '{print $5, $8}' >&2
127235 127235
$ </proc/self/stat awk '{print $5, $8; system("exec sleep 1")}' >&2 | ps -o pid,pgid,comm
131569 131569
PID PGID COMMAND
124948 124948 zsh
131569 131569 awk
131570 131569 ps
131571 131569 sleep
$ </proc/self/stat awk '{print $5, $8}' >&2 | { :; }
127410 127410
$ </proc/self/stat awk '{print $5, $8}' >&2 | { : | :; }
127496 124948
In that latter case, awk is in a different process group
(127496) from the terminal foreground process group (124948
which here is the process group of the main shell process!).
--
Stephane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author