Skip to content

Commit cde763d

Browse files
authored
Merge pull request #50 from devilbox/release-0.47
Ensure xargs with with -P option
2 parents 8671fd2 + 832660e commit cde763d

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/03-test-xargs.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
set -u
5+
set -o pipefail
6+
7+
CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"
8+
9+
IMAGE="${1}"
10+
#NAME="${2}"
11+
#VERSION="${3}"
12+
TAG="${4}"
13+
ARCH="${5}"
14+
15+
16+
###
17+
### Load Library
18+
###
19+
# shellcheck disable=SC1091
20+
. "${CWD}/.lib.sh"
21+
22+
23+
RAND_NAME="$( get_random_name )"
24+
25+
###
26+
### Startup container
27+
###
28+
FILES="$( \
29+
run "docker run --rm --platform ${ARCH} \
30+
-e DEBUG_ENTRYPOINT=2 \
31+
-e DEBUG_RUNTIME=1 \
32+
-e NEW_UID=$( id -u ) \
33+
-e NEW_GID=$( id -g ) \
34+
--entrypoint=bash \
35+
--name ${RAND_NAME} ${IMAGE}:${TAG} -c '
36+
find /lib -print0 | xargs -n1 -0 -P 2
37+
'"
38+
)"
39+
40+
if [ -z "${FILES}" ]; then
41+
>&2 echo "Error, no files found with 'find' and 'xargs'"
42+
exit 1
43+
fi
44+
45+
echo "[OK] xargs works"

0 commit comments

Comments
 (0)