Patchwork [wwwdocs] Further improve error handling of bin/preprocess

login
register
mail settings
Submitter Gerald Pfeifer
Date Sept. 19, 2010, 11:18 p.m.
Message ID <alpine.LNX.2.00.1009120514110.17560@acrux.dbai.tuwien.ac.at>
Download mbox | patch
Permalink /patch/65181/
State New
Headers show

Comments

Gerald Pfeifer - Sept. 19, 2010, 11:18 p.m.
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.

Patch

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 -- \