Browse Source

new: redirect standard logs towards stderr if running an action

This allows direct actions to produce output that won't be messed
around by the logs.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
master 1.5.11
Valentin Lab 2 years ago
parent
commit
a93dc7c1fa
  1. 12
      bin/compose-core

12
bin/compose-core

@ -3850,6 +3850,10 @@ fi
_setup_state_dir
mkdir -p "$CACHEDIR" || exit 1
log () { cat; }
export -f log
##
## Argument parsing
##
@ -3887,6 +3891,8 @@ while read-0 arg; do
--quiet|-q)
export QUIET=true
export wrap_opts+=("-q")
log () { cat >&2; }
export -f log
;;
--version|-V)
print_version
@ -4081,6 +4087,10 @@ if [ -z "$is_docker_compose_action" -a "$action" ]; then
esac
} < <(has_service_action "$action_service" "$action")
services_args=("$action_service")
## Divert logging to stdout to stderr
log () { cat >&2; }
export -f log
else
die "Unknown action '${DARKCYAN}$action$NORMAL': It doesn't match any docker-compose commands nor inner charm actions."
fi
@ -4185,7 +4195,7 @@ if [ -n "$full_init" ]; then
run_service_hook pre_deploy "${services_args[@]}" || exit 1
fi
fi | log
if [ "$action" == "run" -a "${#services_args}" != 0 ]; then
charm=$(get_service_charm "${services_args[0]}") || exit 1

Loading…
Cancel
Save