bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: `wait -n` returns 127 when it shouldn't


From: Greg Wooledge
Subject: Re: `wait -n` returns 127 when it shouldn't
Date: Thu, 18 May 2023 07:35:35 -0400

On Thu, May 18, 2023 at 02:16:17PM +1000, Martin D Kealey wrote:
> If there is silent reaping going on (other than “wait -n” or “trap ...
> SIGCHLD”) [...]

Yes, bash silently reaps child processes.

unicorn:~$ tty
/dev/pts/2
unicorn:~$ sleep 5 & sleep 7 &
[1] 942813
[2] 942814


unicorn:~$ tty
/dev/pts/0
unicorn:~$ ps -ft pts/2
UID          PID    PPID  C STIME TTY          TIME CMD
greg         973     959  0 Apr29 pts/2    00:00:00 bash
greg      942813     973  0 07:29 pts/2    00:00:00 sleep 5
greg      942814     973  0 07:29 pts/2    00:00:00 sleep 7
unicorn:~$ ps -ft pts/2
UID          PID    PPID  C STIME TTY          TIME CMD
greg         973     959  0 Apr29 pts/2    00:00:00 bash


I didn't touch pts/2 at all during this time.  I just ran the ps commands
on pts/0.  As you can see, the two sleep processes are just *gone*.  They
are not hanging around as zombies waiting for me to do something on
pts/2.  At no point did I ever call "wait" explicitly.

I'm fairly sure most (or all?) shells do this, not just bash.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]