* Make it possible to override the log writer (from its default,

`tee').  Useful in the build farm where we want to write logs
  through `bzip2'.

svn path=/nixpkgs/trunk/; revision=2270
This commit is contained in:
Eelco Dolstra 2005-02-22 15:03:24 +00:00
parent 2e0380b7a0
commit afc8ae625f

View File

@ -230,8 +230,7 @@ startLog() {
# This required named pipes (fifos). # This required named pipes (fifos).
logFifo=$NIX_BUILD_TOP/log_fifo logFifo=$NIX_BUILD_TOP/log_fifo
test -p $logFifo || mkfifo $logFifo test -p $logFifo || mkfifo $logFifo
tee $logDir/$logFile < $logFifo & startLogWrite "$logDir/$logFile" "$logFifo"
logTeePid=$!
exec > $logFifo 2>&1 exec > $logFifo 2>&1
else else
exec > $logDir/$logFile 2>&1 exec > $logDir/$logFile 2>&1
@ -239,6 +238,13 @@ startLog() {
fi fi
} }
# Factored into a separate function so that it can be overriden.
startLogWrite() {
tee "$1" < "$2" &
logWriterPid=$!
}
if test -z "$logDir"; then if test -z "$logDir"; then
logDir=$out/log logDir=$out/log
fi fi
@ -252,9 +258,9 @@ stopLog() {
# Wait until the tee process has died. Otherwise output from # Wait until the tee process has died. Otherwise output from
# different phases may be mixed up. # different phases may be mixed up.
if test -n "$logTeePid"; then if test -n "$logWriterPid"; then
wait $logTeePid wait $logWriterPid
logTeePid= logWriterPid=
rm $logFifo rm $logFifo
fi fi
fi fi