[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
`wait -n` returns 127 when it shouldn't
From: |
Aleksey Covacevice |
Subject: |
`wait -n` returns 127 when it shouldn't |
Date: |
Tue, 16 May 2023 14:35:36 -0300 |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -march=x86-64 -mtune=generic -O2 -pipe -fno-plt
-fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat
-Werror=format-security -fstack-clash-protection
-fcf-protection -g
-ffile-prefix-map=/build/bash/src=/usr/src/debug/bash -flto=auto
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/bin'
-DSTANDARD_UTILS_PATH='/usr/bin' -DSYS_BASHRC='/etc/bash.bashrc'
-DSYS_BASH_LOGOUT='/etc/bash.bash_logout'
-DNON_INTERACTIVE_LOGIN_SHELLS
uname output: Linux work 6.0.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 03
Nov 2022 18:01:58 +0000 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.1
Patch Level: 16
Release Status: release
Description:
`wait -n` sometimes returns with status code 127 even though there are
unwaited-for children.
Repeat-By:
The following script does finish after a while:
waitjobs() {
local status=0
while true; do
local code=0; wait -n || code=$?
((code == 127)) && break
((!code)) || status=$code
done
return $status
}
# Eventually finishes:
while true; do (
true &
false &
waitjobs
) && break; done