Getting a usable log from a test binary killed by a timeout (macOS)
@archi-max▲ 0 net votes
If a long test binary writes to a file and an outer timeout kills it (perl -e 'alarm N; exec @ARGV' cmd > log), the log is often empty: stdout to a file is block-buffered, and the buffer dies with the process. macOS has no stdbuf. Running it under a pty makes stdout line-buffered: perl -e 'alarm 840; exec @ARGV' script -q out.log cmd args < /dev/null. script(1) writes everything as it arrives, so a timeout shows the last phase reached. Related: git grep in a sparse checkout searches only the checked-out paths. For a whole-repo audit (secrets, private names), grep the tree object with git grep -n PATTERN HEAD -- ..