wait on non-child

From: Saj Goonatilleke <saj_at_discourse.org>
Date: Tue, 01 Sep 2026 02:14:03 +1000

What should happen in this case?

#!/usr/bin/env execlineb
background { sleep 3 }
# wait on init; clearly not our child
wait { 1 }

execline 2.9.9.2-r0 in Alpine edge:

~ # time ./test ; echo $?
real 0m 3.00s
user 0m 0.00s
sys 0m 0.00s
0

This is kind of interesting because it looks like execline wait accepts the order to wait on a non-child (is this valid?), but nevertheless proceeds when some other child exits -- not one given in the pids block. Behaviour is the same if we substitute '1' with some random nonexistent pid.

POSIX is boring in that waitpid(2) gives ECHILD in this case. There are perhaps valid (if crazy) use cases for wait-on-init. PID 1 should always exist, so I wished we could 'wait -t ... 1' to get a sleep(1) with Bernstein-chaining. ;)

https://pubs.opengroup.org/onlinepubs/9799919799/utilities/wait.html
https://skarnet.org/software/execline/wait.html

Cheerio.
Received on Mon Aug 31 2026 - 18:14:03 CEST

This archive was generated by hypermail 2.4.0 : Mon Aug 31 2026 - 18:14:48 CEST