Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: $PPID not updated when the PPID changes (parent killed)
- X-seq: zsh-workers 48852
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: $PPID not updated when the PPID changes (parent killed)
- Date: Sun, 16 May 2021 11:37:15 -0700
- Archived-at: <https://zsh.org/workers/48852>
- In-reply-to: <20210516152418.GA39669@zira.vinc17.org>
- List-id: <zsh-workers.zsh.org>
- References: <20210516152418.GA39669@zira.vinc17.org>
On Sun, May 16, 2021 at 8:24 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> i.e. $PPID is not updated when the PPID changes, i.e. the parent
> process is killed.
$PPID means the ID of the process that spawned this one, not the
current value of getppid().
If you want the latter, it's $sysparams[ppid] (with the zsh/system
module loaded). In fact the correct way to determine whether the
original parent has exited is to check (( PPID != sysparams[ppid] )).
We could enable a non-portable way to be alerted on parent exit using
prctl() now that HAVE_PRCTL is being checked by configure, but it
would be expensive to emulate in other cases.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author