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' | 10 1. hostname finishes with '.google.com' |
(...skipping 23 matching lines...) Expand all Loading... |
34 print 'Sending crash report ...' | 34 print 'Sending crash report ...' |
35 try: | 35 try: |
36 params = { | 36 params = { |
37 'args': sys.argv, | 37 'args': sys.argv, |
38 'stack': stack, | 38 'stack': stack, |
39 'user': getpass.getuser(), | 39 'user': getpass.getuser(), |
40 'exception': last_tb, | 40 'exception': last_tb, |
41 'host': socket.getfqdn(), | 41 'host': socket.getfqdn(), |
42 'cwd': os.getcwd(), | 42 'cwd': os.getcwd(), |
43 } | 43 } |
| 44 # No exception type(s) specified |
| 45 # pylint: disable=W0702 |
44 try: | 46 try: |
45 # That may not always work. | 47 # That may not always work. |
46 params['exception'] = str(last_tb) | 48 params['exception'] = str(last_tb) |
47 except: | 49 except: |
48 pass | 50 pass |
49 print('\n'.join(' %s: %s' % (k, v[0:50]) for k, v in params.iteritems())) | 51 print('\n'.join(' %s: %s' % (k, v[0:50]) for k, v in params.iteritems())) |
50 request = urllib.urlopen(url, urllib.urlencode(params)) | 52 request = urllib.urlopen(url, urllib.urlencode(params)) |
51 print(request.read()) | 53 print(request.read()) |
52 request.close() | 54 request.close() |
53 except IOError: | 55 except IOError: |
(...skipping 20 matching lines...) Expand all Loading... |
74 | 76 |
75 # Skip unit tests and we don't want anything from non-googler. | 77 # Skip unit tests and we don't want anything from non-googler. |
76 if (not 'test' in sys.modules['__main__'].__file__ and | 78 if (not 'test' in sys.modules['__main__'].__file__ and |
77 not 'NO_BREAKPAD' in os.environ and | 79 not 'NO_BREAKPAD' in os.environ and |
78 (socket.getfqdn().endswith('.google.com') or | 80 (socket.getfqdn().endswith('.google.com') or |
79 socket.getfqdn().endswith('.chromium.org'))): | 81 socket.getfqdn().endswith('.chromium.org'))): |
80 Register() | 82 Register() |
81 | 83 |
82 # Uncomment this line if you want to test it out. | 84 # Uncomment this line if you want to test it out. |
83 #Register() | 85 #Register() |
OLD | NEW |