fix: streamline parallel stack output

This commit is contained in:
lingkai5wu committed 2026-10-10 16:04:50 +08:00
1 parent 5e20bc70af
commit c76b2dfb9d
1 file changed
+11 -2
+11 -2
View File
@@ -254,19 +254,27 @@ stack_group() {
compose() {
local stack="$1"
shift
local -a docker_args=(compose)
if [[ "${STACKS_FORCE_ANSI:-0}" == "1" ]]; then
docker_args+=(--ansi always)
fi
(
cd -- "$STACKS_DIR/$stack" || exit 1
docker compose "$@"
docker "${docker_args[@]}" "$@"
)
}
run_stack() {
local stack="$1"
local action="$2"
local show_heading="${3:-1}"
if [[ "$show_heading" == "1" ]]; then
echo
echo "==> $stack: $action"
fi
case "$action" in
up)
@@ -289,8 +297,9 @@ run_stack_prefixed() {
local action="$2"
local line status
run_stack "$stack" "$action" 2>&1 |
STACKS_FORCE_ANSI=1 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]}"