#!/bin/bash # Automatic log file redirection for build scripts # # Source this at the top of build scripts to redirect all output to a log file. # Uses self-re-exec pattern: the script re-launches itself with external redirection, # which reliably captures ALL output including docker compose TTY output. # # Detection logic: # - If KICAD_LOG_NESTED=1 (re-exec'd or nested call) → output normally # - If inside Docker (/workspace exists) → output normally # - Otherwise → re-exec with output redirected to logs/