exit with non-zero child thread status code

This commit is contained in:
Yifan Gao 2020-06-23 00:14:13 +08:00
parent 82653dcf0e
commit 6f9976598d
2 changed files with 15 additions and 2 deletions

View File

@ -38,5 +38,18 @@ prepare_data(){
curl -sSL https://bgp.potaroo.net/cidr/autnums.html | awk '-F[<>]' '{print $3,$5}' | grep '^AS' > asnames.txt &
prepare_data_v4 &
prepare_data_v6 &
wait
wait_exit
}
wait_exit(){
local oldstate=$(set +o)
set +e
local s=0
while [[ $s -ne 127 ]]; do
[[ $s -ne 0 ]] && exit $s
wait -n
s=$?
done
eval "$oldstate"
return 0
}

View File

@ -13,4 +13,4 @@ for file in operator/*.conf; do
get_asn $file | xargs bgptools -b rib6.txt | cidr-merger -s > result/${operator}6.txt &
done
wait
wait_exit