Skip to content

Commit

Permalink
Merge pull request #47 from devilbox/release-0.47
Browse files Browse the repository at this point in the history
Ensure xargs with with -P option
  • Loading branch information
cytopia authored Mar 28, 2022
2 parents 26470c5 + 83a885d commit 5aec6aa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfiles/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ENV BUILD_DEPS \
ENV RUN_DEPS \
ca-certificates \
bash \
findutils \
openssl \
py-yaml \
supervisor \
Expand Down
45 changes: 45 additions & 0 deletions tests/03-test-xargs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

CWD="$(cd -P -- "$(dirname -- "$0")" && pwd -P)"

IMAGE="${1}"
#NAME="${2}"
#VERSION="${3}"
TAG="${4}"
ARCH="${5}"


###
### Load Library
###
# shellcheck disable=SC1091
. "${CWD}/.lib.sh"


RAND_NAME="$( get_random_name )"

###
### Startup container
###
FILES="$( \
run "docker run --rm --platform ${ARCH} \
-e DEBUG_ENTRYPOINT=2 \
-e DEBUG_RUNTIME=1 \
-e NEW_UID=$( id -u ) \
-e NEW_GID=$( id -g ) \
--entrypoint=bash \
--name ${RAND_NAME} ${IMAGE}:${TAG} -c '
find /lib -print0 | xargs -n1 -0 -P 2
'"
)"

if [ -z "${FILES}" ]; then
>&2 echo "Error, no files found with 'find' and 'xargs'"
exit 1
fi

echo "[OK] xargs works"

0 comments on commit 5aec6aa

Please sign in to comment.