[pushed] wwwdocs: preprocess: Check whether input files exist
Gerald Pfeifer
gerald@pfeifer.com
Fri May 19 14:01:59 GMT 2023
This has not come up in all those years since the preprocess script
usually is invoked from other scripts, notably post commit hooks. It
can, however, be invoked manually, and error handling is generally a
good thing.
Instead of
cat: foo/bar/index.html: No such file or directory
New file /www/gcc/htdocs/foo/bar/index.html
and an empty output file, we now get
Input file foo/bar/index.html not found.
when invoking `preprocess foo/bar/index.html`.
Pushed.
Gerald
---
bin/preprocess | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/bin/preprocess b/bin/preprocess
index c62ba457..c6d34c4b 100755
--- a/bin/preprocess
+++ b/bin/preprocess
@@ -155,6 +155,11 @@ process_file()
# Strip possibly leading "./".
f=`echo $1 | sed -e 's#^\./##'`
+ if [ ! -f "$SOURCETREE/$f" ] wwwdocs:; then
+ echo "Input file $f not found."
+ return
+ fi
+
if [ ! -d "$DESTTREE/`dirname $f`" ] wwwdocs:; then
echo "Creating new directory `dirname $f`."
mkdir -p $DESTTREE/`dirname $f`
--
2.40.1
More information about the Gcc-patches
mailing list