#!/bin/bash # Debug script to test container output behavior set -euo pipefail # Script directory and project root detection SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" echo "=== HOST DEBUG TEST ===" echo "SCRIPT_DIR: $SCRIPT_DIR" echo "PROJECT_ROOT: $PROJECT_ROOT" echo "PWD: $(pwd)" echo "USER: $(whoami)" # Source common functions source "${SCRIPT_DIR}/lib/common.sh" echo "=== AFTER SOURCING COMMON.SH ===" log_info "Testing log_info function" log_warn "Testing log_warn function" log_error "Testing log_error function" echo "=== TESTING SAFE_EXECUTE ===" safe_execute echo "Testing safe_execute with simple command" safe_execute ls -la "${SCRIPT_DIR}" echo "=== TESTING IN_CONTAINER ===" if in_container; then log_info "Running inside container" else log_info "Running on host" fi echo "=== CHECKING DOCKER FUNCTIONS ===" source "${SCRIPT_DIR}/lib/docker.sh" if command_exists "podman" || command_exists "docker"; then log_info "Container runtime available, testing container run" docker_detect_runtime # Test minimal container run log_info "Testing minimal container echo" if [[ -n "${CONTAINER_RUNTIME:-}" ]]; then echo "Running: ${CONTAINER_RUNTIME} run --rm alpine:3.22 echo 'Container test successful'" ${CONTAINER_RUNTIME} run --rm alpine:3.22 echo "Container test successful" echo "Running: ${CONTAINER_RUNTIME} run --rm alpine:3.22 sh -c 'echo First line; echo Second line; echo Third line'" ${CONTAINER_RUNTIME} run --rm alpine:3.22 sh -c 'echo First line; echo Second line; echo Third line' echo "Testing with TTY:" ${CONTAINER_RUNTIME} run --rm -it alpine:3.22 sh -c 'echo TTY test line 1; echo TTY test line 2' fi else log_warn "No container runtime available" fi echo "=== DEBUG TEST COMPLETE ==="