chiark / gitweb /
bin/mdw-build: Do all of the log descriptor setting in one place.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 May 2020 14:00:31 +0000 (15:00 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 10 May 2020 18:46:54 +0000 (19:46 +0100)
Rather than setting things up for a verbose build and then changing
things later.

bin/mdw-build

index fb98ffad6675fd06e1a2d10c65bb58d65e677fb0..b5bbbf3a1cf703e8b1ef8337edbf3b33485ec405 100755 (executable)
@@ -193,8 +193,6 @@ case $jobs in 1) ;; *) makeopts="$makeopts -j$jobs" ;; esac
 ## diag -- null (verbose), or logfile (quiet); primary diagnostic output
 ## term -- orginal stderr; secondary diagnostic output (with colours)
 
-exec {log}>&2 {diag}>/dev/null {term}>&2
-
 notify () {
   colour=$1 message=$2
   echo $message >&$diag
@@ -267,12 +265,15 @@ releasepath=$toppath/dist-$build$qual
 chmod -R +w $releasepath 2>/dev/null || :
 rm -rf $releasepath 2>/dev/null || :
 mkdir $releasepath
+exec {term}>&2
 case $verbose in
   no)
-    exec {log}>&- {diag}>&-
     exec {diag}>$releasepath/mdw-build.log {log}>&$diag ||
       fail "Failed to create log."
     ;;
+  yes)
+    exec {diag}>/dev/null {log}>&2
+    ;;
 esac
 
 ## Repeat the earlier assignments for tbe benefit of the logfile.