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