From afc8ae625fdae7deb94fc07f7db296007e252d0f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 22 Feb 2005 15:03:24 +0000 Subject: [PATCH] * 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 --- pkgs/stdenv/generic/setup.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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