fix: preserve native compose output

This commit is contained in:
lingkai5wu committed 2026-10-10 16:21:16 +08:00
1 parent 50d9fc69ad
commit fc2504df5a
1 file changed
+2 -27
+2 -27
View File
@@ -9,11 +9,6 @@ CONFIG_FILE="${STACKS_CONFIG:-$STACKS_DIR/manage.conf}"
LOCK_FILE="${STACKS_LOCK_FILE:-/run/lock/stacks-manage.lock}" LOCK_FILE="${STACKS_LOCK_FILE:-/run/lock/stacks-manage.lock}"
DEFAULT_MAX_PARALLEL=2 DEFAULT_MAX_PARALLEL=2
OUTPUT_IS_TTY=0
if [[ -t 1 && -z "${NO_COLOR+x}" ]]; then
OUTPUT_IS_TTY=1
fi
CONFIG_GROUP_NAMES=() CONFIG_GROUP_NAMES=()
CONFIG_GROUP_LIMITS=() CONFIG_GROUP_LIMITS=()
@@ -260,15 +255,10 @@ stack_group() {
compose() { compose() {
local stack="$1" local stack="$1"
shift shift
local -a docker_args=(compose)
if [[ "${STACKS_FORCE_ANSI:-0}" == "1" ]]; then
docker_args+=(--ansi always)
fi
( (
cd -- "$STACKS_DIR/$stack" || exit 1 cd -- "$STACKS_DIR/$stack" || exit 1
docker "${docker_args[@]}" "$@" docker compose "$@"
) )
} }
@@ -298,21 +288,6 @@ run_stack() {
esac esac
} }
run_stack_prefixed() {
local stack="$1"
local action="$2"
local line status
STACKS_FORCE_ANSI="$OUTPUT_IS_TTY" run_stack "$stack" "$action" 0 2>&1 |
while IFS= read -r line || [[ -n "$line" ]]; do
[[ -n "$line" ]] || continue
printf '[%s] %s\n' "$stack" "$line"
done
status="${PIPESTATUS[0]}"
return "$status"
}
run_group() { run_group() {
local group_index="$1" local group_index="$1"
local action="$2" local action="$2"
@@ -356,7 +331,7 @@ run_group() {
( (
status=0 status=0
run_stack_prefixed "$stack" "$action" || status=$? run_stack "$stack" "$action" 0 || status=$?
printf '\n' >&"$semaphore_fd" printf '\n' >&"$semaphore_fd"
exit "$status" exit "$status"
) & ) &