Index: breakpad.py |
diff --git a/breakpad.py b/breakpad.py |
index afe469c6c5128b3d3a4dce08609bb4c66c49e5f5..2db495483731061cb25113603f4946498fcd1c04 100644 |
--- a/breakpad.py |
+++ b/breakpad.py |
@@ -33,6 +33,12 @@ _TIME_STARTED = time.time() |
_HOST_NAME = socket.getfqdn() |
+# Skip unit tests and we don't want anything from non-googler. |
+IS_ENABLED = ( |
+ not 'test' in getattr(sys.modules['__main__'], '__file__', '') and |
+ not 'NO_BREAKPAD' in os.environ and |
+ _HOST_NAME.endswith(('.google.com', '.chromium.org'))) |
+ |
def post(url, params): |
"""HTTP POST with timeout when it's supported.""" |
@@ -75,6 +81,9 @@ def FormatException(e): |
def SendStack(last_tb, stack, url=None, maxlen=50): |
"""Sends the stack trace to the breakpad server.""" |
+ if not IS_ENABLED: |
+ # Make sure to not send anything for non googler. |
+ return |
if not url: |
url = DEFAULT_URL + '/breakpad' |
print 'Sending crash report ...' |
@@ -133,11 +142,7 @@ def Register(): |
atexit.register(CheckForException) |
-# Skip unit tests and we don't want anything from non-googler. |
-if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and |
- not 'NO_BREAKPAD' in os.environ and |
- (_HOST_NAME.endswith('.google.com') or |
- _HOST_NAME.endswith('.chromium.org'))): |
+if IS_ENABLED: |
Register() |
# Uncomment this line if you want to test it out. |