d21aeb44e0
We want to redirect both stdout and stderr to the log, so just do both
redirections at once. This simplifies the call to make, which was
inherited from afdb545b28 (tools: new tool to filter the output of
make) when brmake was using unbuffer (and even then it was not entirely
waranted to do the redirection that way).
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
38 lines
790 B
Bash
Executable File
38 lines
790 B
Bash
Executable File
#!/bin/bash
|
|
# (C) 2016, "Yann E. MORIN" <yann.morin.1998@free.fr>
|
|
# License: WTFPL, https://spdx.org/licenses/WTFPL.html
|
|
|
|
main() {
|
|
local ret start d h m mf
|
|
|
|
start=${SECONDS}
|
|
|
|
make "${@}" \
|
|
&> >( while read -r line; do
|
|
printf "%(%Y-%m-%dT%H:%M:%S)T %s\n" -1 "${line}"
|
|
done \
|
|
|tee -a br.log \
|
|
|grep --colour=never -E '>>>'
|
|
)
|
|
ret=${?}
|
|
|
|
d=$((SECONDS-start))
|
|
printf "Done in "
|
|
h=$((d/3600))
|
|
d=$((d%3600))
|
|
[ ${h} -eq 0 ] || { printf "%dh " ${h}; mf="02"; }
|
|
m=$((d/60))
|
|
d=$((d%60))
|
|
[ ${m} -eq 0 ] || { printf "%${mf}dmin " ${m}; sf="02"; }
|
|
printf "%${sf}ds" ${d}
|
|
|
|
if [ ${ret} -ne 0 ]; then
|
|
printf " (error code: %s)" ${ret}
|
|
fi
|
|
printf "\n"
|
|
|
|
return ${ret}
|
|
}
|
|
|
|
main "${@}"
|