OLD | NEW |
1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Breakpad for Python. | 5 """Breakpad for Python. |
6 | 6 |
7 Sends a notification when a process stops on an exception. | 7 Sends a notification when a process stops on an exception. |
8 | 8 |
9 It is only enabled when all these conditions are met: | 9 It is only enabled when all these conditions are met: |
10 1. hostname finishes with '.google.com' or 'chromium.org' | 10 1. hostname finishes with '.google.com' or 'chromium.org' |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 def Register(): | 127 def Register(): |
128 """Registers the callback at exit. Calling it multiple times is no-op.""" | 128 """Registers the callback at exit. Calling it multiple times is no-op.""" |
129 global _REGISTERED | 129 global _REGISTERED |
130 if _REGISTERED: | 130 if _REGISTERED: |
131 return | 131 return |
132 _REGISTERED = True | 132 _REGISTERED = True |
133 atexit.register(CheckForException) | 133 atexit.register(CheckForException) |
134 | 134 |
135 | 135 |
136 # Skip unit tests and we don't want anything from non-googler. | 136 # Skip unit tests and we don't want anything from non-googler. |
137 if (not 'test' in sys.modules['__main__'].__file__ and | 137 if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and |
138 not 'NO_BREAKPAD' in os.environ and | 138 not 'NO_BREAKPAD' in os.environ and |
139 (_HOST_NAME.endswith('.google.com') or | 139 (_HOST_NAME.endswith('.google.com') or |
140 _HOST_NAME.endswith('.chromium.org'))): | 140 _HOST_NAME.endswith('.chromium.org'))): |
141 Register() | 141 Register() |
142 | 142 |
143 # Uncomment this line if you want to test it out. | 143 # Uncomment this line if you want to test it out. |
144 #Register() | 144 #Register() |
OLD | NEW |