From a03ae8ba516122d640f6f8326d14f6accccd1eff Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sun, 25 Nov 2018 22:17:12 +0100 Subject: [PATCH] new: bail out when failing to read compose file and be more explicit --- bin/compose | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/compose b/bin/compose index 06b0e23..388b784 100755 --- a/bin/compose +++ b/bin/compose @@ -2229,7 +2229,7 @@ get_compose_yml_location() { echo "$COMPOSE_YML_FILE" return 0 fi - parent=$(while ! [ -e "./compose.yml" ]; do + parent=$(while ! [ -f "./compose.yml" ]; do [ "$PWD" == "/" ] && exit 0 cd .. done; echo "$PWD" @@ -2269,7 +2269,10 @@ get_compose_yml_content() { fi if [ -e "$COMPOSE_YML_FILE" ]; then debug "Found $WHITE$exname$NORMAL YAML file in '$COMPOSE_YML_FILE'." - COMPOSE_YML_CONTENT=$(cat "$COMPOSE_YML_FILE") + COMPOSE_YML_CONTENT=$(cat "$COMPOSE_YML_FILE") || { + err "Could not read '$COMPOSE_YML_FILE'." + return 1 + } else debug "No compose file found. Using an empty one." COMPOSE_YML_CONTENT=""