Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
7 lines
488 B
Bash
7 lines
488 B
Bash
#!/usr/bin/env bash
|
|
# ts-wrap.sh TSFILE cmd args...: run cmd with stderr merged into stdout, pass every line through unchanged and append "epoch_seconds line" to TSFILE as it arrives.
|
|
# Used to learn when each turn of the long session finished, so the decode window of a turn can be joined to the machine-state samples. Exit status = cmd's.
|
|
ts=$1; shift
|
|
"$@" 2>&1 | while IFS= read -r l; do printf '%s\n' "$l"; printf '%s %s\n' "$(date +%s.%N)" "$l" >>"$ts"; done
|
|
exit "${PIPESTATUS[0]}"
|