taskwarrior/test/test_hooks/wrapper.sh
Max Rossmannek 2931be613b
Enforce Python 3 in test_hooks/wrapper
This change was not included in the previous commit because the sed
command I used included the `/usr/bin/env` path to ensure I don't
replace any occurences of the word `python` which I did not wish to
replace.
2020-12-06 10:01:09 -05:00

18 lines
547 B
Bash

#!/usr/bin/env 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 $(python3 -c 'import time; print(time.time())') with '$@'" >> ${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