File: wrapper.sh

package info (click to toggle)
task 2.6.2%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,088 kB
  • sloc: cpp: 45,965; python: 12,713; sh: 785; perl: 189; makefile: 21
file content (18 lines) | stat: -rw-r--r-- 548 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/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: https://tldp.org/LDP/abs/html/process-sub.html

EXITCODE=$?
echo "! Exit code: ${EXITCODE}" >> ${OUT}

exit $EXITCODE