Browse Source

fix: better error reporting when ``shyaml`` fails not for syntax reasons.

raw-remaining-args
Valentin Lab 6 years ago
parent
commit
1ebefc6735
  1. 8
      bin/compose

8
bin/compose

@ -2404,12 +2404,18 @@ debug "Found $WHITE$exname$NORMAL YAML file in '$COMPOSE_YML_FILE'."
output=$(shyaml get-value < "$COMPOSE_YML_FILE" 2>&1)
if [ "$?" != 0 ]; then
err "Invalid YAML in '$COMPOSE_YML_FILE':"
outputed_something=
while IFS='' read -r line1 && IFS='' read -r line2; do
[ "$outputed_something" ] || err "Invalid YAML in '$COMPOSE_YML_FILE':"
outputed_something=true
echo "$line1 $GRAY($line2)$NORMAL"
done < <(echo "$output" | grep ^yaml.scanner -A 100 |
sed -r 's/^ in "<stdin>", //g' | sed -r 's/^yaml.scanner.[a-zA-Z]+: //g') |
prefix " $GRAY|$NORMAL "
[ "$outputed_something" ] || {
err "Unexpected error while running 'shyaml get-value' on '$COMPOSE_YML_FILE':"
echo "$output" | prefix " $GRAY|$NORMAL "
}
exit 1
fi

Loading…
Cancel
Save