]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/publish_toolstate.py
Auto merge of #76278 - jethrogb:jb/sgx-rwlock-init-test, r=Mark-Simulacrum
[rust.git] / src / tools / publish_toolstate.py
index 72b3df8377abb2f7764d60f831e218750430e156..9cfde0c232b337deb85565851fc1f28903e78e6a 100755 (executable)
@@ -275,7 +275,12 @@ def update_latest(
         return message
 
 
-if __name__ == '__main__':
+# Warning: Do not try to add a function containing the body of this try block.
+# There are variables declared within that are implicitly global; it is unknown
+# which ones precisely but at least this is true for `github_token`.
+try:
+    if __name__ != '__main__':
+        exit(0)
     repo = os.environ.get('TOOLSTATE_VALIDATE_MAINTAINERS_REPO')
     if repo:
         github_token = os.environ.get('TOOLSTATE_REPO_ACCESS_TOKEN')
@@ -342,3 +347,6 @@ if __name__ == '__main__':
         }
     ))
     response.read()
+except urllib2.HTTPError as e:
+    print("HTTPError: %s\n%s" % (e, e.read()))
+    raise