[wwwdocs] Further improve error handling of bin/preprocess

Gerald Pfeifer gerald@pfeifer.com
Mon Sep 20 08:24:00 GMT 2010


When I ran into a problem with this script two(?) weeks ago there were
two cases where I added some more error handling.  This is the second.
Now applied and tested on gcc.gnu.org as well.

Gerald


Check result of every MetaHTML invocation and abort in case of an error.

Index: preprocess
===================================================================
RCS file: /cvs/gcc/wwwdocs/bin/preprocess,v
retrieving revision 1.48
diff -u -3 -p -r1.48 preprocess
--- preprocess	12 Sep 2010 03:05:44 -0000	1.48
+++ preprocess	19 Sep 2010 23:13:36 -0000
@@ -108,15 +108,21 @@ process_html_file()
     export PREPROCESS_FILE
 
     # Prepend the MetaHTML style, set the MetaHTML include directory,
-    # and process the page; then remove leading blank lines and single
-    # line comments.
+    # and process the page.
 
     cat $STYLE > $TMPDIR/input
     printf '<set-var MHTML::INCLUDE-PREFIX="%s">\n' `pwd` >> $TMPDIR/input
     cat $f >> $TMPDIR/input
+
+    if ! ${MHC} $TMPDIR/input > $TMPDIR/output.raw; then
+        echo "${MHC} failed; aborting."
+        exit 1
+    fi
+
+    # Then remove leading blank lines and single line comments.
     # Use sed to work around makeinfo 4.7 brokenness.
     # Use sed to work around MetaHTML brokenness wrt. <DIV>.
-    ${MHC} $TMPDIR/input \
+    cat $TMPDIR/output.raw \
         | sed -e 's/_002d/-/g' -e 's/_002a/*/g' \
         | sed -e 's/<DIV/<div/g' \
         | awk -- \



More information about the Gcc-patches mailing list