[Git][NTPsec/ntpsec][master] In linkcheck, a better error message on file open failure.

Eric S. Raymond gitlab at mg.gitlab.com
Sat Dec 24 17:41:28 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
0b29f7ad by Eric S. Raymond at 2016-12-24T12:41:19-05:00
In linkcheck, a better error message on file open failure.

- - - - -


1 changed file:

- devel/linkcheck


Changes:

=====================================
devel/linkcheck
=====================================
--- a/devel/linkcheck
+++ b/devel/linkcheck
@@ -43,7 +43,11 @@ def tabulate(path):
                 includer = iostack[-1][1].name
                 dirname = os.path.dirname(includer[len(prefix):])
             newpath = os.path.join(prefix, dirname, filestem)
-            iostack.append((linecount, open(newpath)))
+            try:
+                iostack.append((linecount, open(newpath)))
+            except (IOError, OSError):
+                sys.stderr.write("linkcheck: Can't open %s\n" % newpath)
+                raise SystemExit(1)
             continue
         # Ordinary processing 
         # This is the tricky part. Because we're reference-checking the



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0b29f7ad1b778385bf94a0779fa66a8b9ba4c622
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161224/4ce86369/attachment.html>


More information about the vc mailing list