From 2cba8a8d5f525c1e9ba4b8c06e396d2ee14fc522 Mon Sep 17 00:00:00 2001 From: Mike Dillon Date: Fri, 9 Oct 2015 23:10:38 -0700 Subject: [PATCH] Avoid xargs -r The -r option is not available on OS X --- test/default-host.bats | 5 ++++- test/multiple-hosts.bats | 5 ++++- test/multiple-ports.bats | 5 ++++- test/wildcard-hosts.bats | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/default-host.bats b/test/default-host.bats index 503bb9f..4e9d84e 100644 --- a/test/default-host.bats +++ b/test/default-host.bats @@ -4,7 +4,10 @@ load test_helpers function setup { # make sure to stop any web container before each test so we don't # have any unexpected contaiener running with VIRTUAL_HOST or VIRUTAL_PORT set - docker ps -q --filter "label=bats-type=web" | xargs -r docker stop >&2 + CIDS=( $(docker ps -q --filter "label=bats-type=web") ) + if [ ${#CIDS[@]} -gt 0 ]; then + docker stop ${CIDS[@]} >&2 + fi } diff --git a/test/multiple-hosts.bats b/test/multiple-hosts.bats index c5c5749..695aec1 100644 --- a/test/multiple-hosts.bats +++ b/test/multiple-hosts.bats @@ -5,7 +5,10 @@ SUT_CONTAINER=bats-nginx-proxy-${TEST_FILE} function setup { # make sure to stop any web container before each test so we don't # have any unexpected contaiener running with VIRTUAL_HOST or VIRUTAL_PORT set - docker ps -q --filter "label=bats-type=web" | xargs -r docker stop >&2 + CIDS=( $(docker ps -q --filter "label=bats-type=web") ) + if [ ${#CIDS[@]} -gt 0 ]; then + docker stop ${CIDS[@]} >&2 + fi } diff --git a/test/multiple-ports.bats b/test/multiple-ports.bats index a8ff314..a520571 100644 --- a/test/multiple-ports.bats +++ b/test/multiple-ports.bats @@ -5,7 +5,10 @@ SUT_CONTAINER=bats-nginx-proxy-${TEST_FILE} function setup { # make sure to stop any web container before each test so we don't # have any unexpected contaiener running with VIRTUAL_HOST or VIRUTAL_PORT set - docker ps -q --filter "label=bats-type=web" | xargs -r docker stop >&2 + CIDS=( $(docker ps -q --filter "label=bats-type=web") ) + if [ ${#CIDS[@]} -gt 0 ]; then + docker stop ${CIDS[@]} >&2 + fi } diff --git a/test/wildcard-hosts.bats b/test/wildcard-hosts.bats index 4e1484f..88ca1e7 100644 --- a/test/wildcard-hosts.bats +++ b/test/wildcard-hosts.bats @@ -5,7 +5,10 @@ SUT_CONTAINER=bats-nginx-proxy-${TEST_FILE} function setup { # make sure to stop any web container before each test so we don't # have any unexpected contaiener running with VIRTUAL_HOST or VIRUTAL_PORT set - docker ps -q --filter "label=bats-type=web" | xargs -r docker stop >&2 + CIDS=( $(docker ps -q --filter "label=bats-type=web") ) + if [ ${#CIDS[@]} -gt 0 ]; then + docker stop ${CIDS[@]} >&2 + fi }