taskwarrior/test/test_hooks/wrapper.sh
2015-02-01 06:23:34 +00:00

18 lines
490 B
Bash

#!/bin/bash
SELF=$(basename $0)
ORIGINALHOOK="$(dirname $0)/original_${SELF}"
IN="${ORIGINALHOOK}.log.in"
OUT="${ORIGINALHOOK}.log.out"
# Let it know that we were executed
echo "% Called at $(date +%s%N)" >> ${IN}
# Log what arrives via stdin to ${IN} and what comes via stdout to ${OUT}
$ORIGINALHOOK < <(tee -a ${IN}) > >(tee -a ${OUT})
# More on the < <() syntax at: http://tldp.org/LDP/abs/html/process-sub.html
EXITCODE=$?
echo "! Exit code: ${EXITCODE}" >> ${OUT}
exit $EXITCODE