Skip to content

Commit

Permalink
In dash interp jobs -r is not supported, so cutting it off (#58)
Browse files Browse the repository at this point in the history
Small fix, since `dash` doesn't really like `jobs -r`. Also if we will use only `-p` - it will display the same pid's even when they are completed, so calling the full jobs afterwards to flush the done jobs.
  • Loading branch information
sparshev committed Feb 26, 2024
1 parent b42228e commit 22f40b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ fi
# Run parallel builds but no more than limit (gox doesn't support all the os/archs we need)
pwait() {
# Note: Dash really don't like jobs to be executed in a pipe or in other shell, soooo...
# Using "-p" to show only PIDs (because it could be multiline) and "-r" to show only running jobs
while jobs -pr > /tmp/jobs_list.tmp; do
# Using "jobs -p" to show only PIDs (because it could be multiline)
# Unfortunately "jobs -r" is not supported in dash, not a big problem with sleep for 1 sec
while jobs -p > /tmp/jobs_list.tmp; do
# Cleanup jobs list, otherwise "jobs -p" will stay the same forever
jobs > /dev/null 2>&1
[ $(cat /tmp/jobs_list.tmp | wc -l) -ge $1 ] || break
sleep 1
done
Expand Down

0 comments on commit 22f40b4

Please sign in to comment.