Skip to content

Commit

Permalink
Merge pull request #3855 from citrus-it/pipelog
Browse files Browse the repository at this point in the history
Use pipelog() in more places
  • Loading branch information
citrus-it authored Feb 18, 2025
2 parents 8028ea6 + a142be7 commit cde6bcb
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions lib/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ EOM
#############################################################################
# Log output of a command to a file
#############################################################################

pipelog() {
$TEE -a $LOGFILE 2>&1
}

logcmd() {
typeset preserve_stdout=0
[ "$1" = "-p" ] && shift && preserve_stdout=1
Expand All @@ -191,18 +196,14 @@ logcmd() {
else
if [ "$preserve_stdout" = 0 ]; then
echo Running: "$@"
"$@" | $TEE -a $LOGFILE 2>&1
"$@" | pipelog
return ${PIPESTATUS[0]}
else
"$@"
fi
fi
}

pipelog() {
$TEE -a $LOGFILE 2>&1
}

c_highlight="`$TPUT setaf 2`"
c_error="`$TPUT setaf 1`"
c_note="`$TPUT setaf 6`"
Expand Down Expand Up @@ -3596,7 +3597,7 @@ check_rtime() {
-f $TMPDIR/rtime.files

if [ -s "$TMPDIR/rtime.err" ]; then
$CAT $TMPDIR/rtime.err | $TEE -a $LOGFILE
$CAT $TMPDIR/rtime.err | pipelog
logerr "ELF runtime problems detected"
fi
}
Expand All @@ -3614,7 +3615,7 @@ check_ssp() {
done < <(rtime_objects)
wait
if [ -s "$TMPDIR/rtime.ssp" ]; then
$CAT $TMPDIR/rtime.ssp | $TEE -a $LOGFILE
$CAT $TMPDIR/rtime.ssp | pipelog
logerr "Found object(s) without SSP"
fi
}
Expand Down Expand Up @@ -3653,7 +3654,7 @@ check_soname() {
done < <(rtime_objects -f)
wait
if [ -s "$TMPDIR/rtime.soname" ]; then
$CAT $TMPDIR/rtime.soname | $TEE -a $LOGFILE
$CAT $TMPDIR/rtime.soname | pipelog
logerr "Found SONAME problems"
fi
}
Expand All @@ -3678,7 +3679,7 @@ check_bmi() {
done < <(rtime_objects)
wait
if [ -s "$TMPDIR/rtime.bmi" ]; then
$CAT $TMPDIR/rtime.bmi | $TEE -a $LOGFILE
$CAT $TMPDIR/rtime.bmi | pipelog
logerr "BMI instruction set found"
fi
}
Expand Down

0 comments on commit cde6bcb

Please sign in to comment.