aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-02-26 00:22:15 -0600
committerRob Landley <rob@landley.net>2016-02-26 00:22:15 -0600
commite17fbf19c4b48d763041761052e98c2b4ee95487 (patch)
treeec470df559887f08734b7315bdca03a2d26b969f
parentf9ca79a7b7762bdc698efb7c34ecaac63540eacb (diff)
downloadtoybox-e17fbf19c4b48d763041761052e98c2b4ee95487.tar.gz
Switch to $! for make.sh process enumeration.
-rwxr-xr-xscripts/make.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/make.sh b/scripts/make.sh
index 84dda343..c73a03df 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -264,17 +264,17 @@ do
LFILES="$LFILES $OUT"
[ "$OUT" -nt "$i" ] && continue
do_loudly $BUILD -c $i -o $OUT &
+ PENDING="$PENDING $!"
# ratelimit to $CPUS many parallel jobs, detecting errors
while true
do
- PENDING="$(echo $PENDING $(jobs -rp) | tr ' ' '\n' | sort -u)"
- [ $(echo -n "$PENDING" | wc -l) -lt "$CPUS" ] && break;
+ [ $(echo "$PENDING" | wc -w) -lt "$CPUS" ] && break;
- wait $(echo "$PENDING" | head -n 1)
+ wait $(echo "$PENDING" | awk '{print $1}')
DONE=$(($DONE+$?))
- PENDING="$(echo "$PENDING" | tail -n +2)"
+ PENDING="$(echo "$PENDING" | sed 's/^ *[0-9]*//')"
done
[ $DONE -ne 0 ] && break
done