From b8d7afaf836f6614cf9e3f767279893aea2b99ed Mon Sep 17 00:00:00 2001 From: Andy Thompson Date: Fri, 27 Jan 2023 16:59:09 +0000 Subject: [PATCH] Guard against compose versions that delete all containers on rm with no arguments --- src/_base/harness/scripts/enable.sh.twig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/_base/harness/scripts/enable.sh.twig b/src/_base/harness/scripts/enable.sh.twig index a5337ab82..25088f19c 100755 --- a/src/_base/harness/scripts/enable.sh.twig +++ b/src/_base/harness/scripts/enable.sh.twig @@ -35,7 +35,9 @@ enable_all() if [ "$HAS_FLAG" = no ]; then # remove all services, keeping console if considered built if console_enabled; then - passthru "${COMPOSE_BIN[*]} ps --services | grep -v -Fxe console | xargs ${COMPOSE_BIN[*]} rm --force --stop --" + if [ -n "$("${COMPOSE_BIN[@]}" ps --services | grep -v -Fxe console)" ]; then + passthru "${COMPOSE_BIN[*]} ps --services | grep -v -Fxe console | xargs ${COMPOSE_BIN[*]} rm --force --stop --" + fi else passthru "${COMPOSE_BIN[@]}" down fi