diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 901c461ee2bf..2efc6392c50d 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -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