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 22 matching lines...) Expand all Loading... |
33 url = DEFAULT_URL | 33 url = DEFAULT_URL |
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 'version': sys.version, |
43 } | 44 } |
44 # No exception type(s) specified | 45 # No exception type(s) specified |
45 # pylint: disable=W0702 | 46 # pylint: disable=W0702 |
46 try: | 47 try: |
47 # That may not always work. | 48 # That may not always work. |
48 params['exception'] = str(last_tb) | 49 params['exception'] = str(last_tb) |
49 except: | 50 except: |
50 pass | 51 pass |
51 print('\n'.join(' %s: %s' % (k, v[0:50]) for k, v in params.iteritems())) | 52 print('\n'.join(' %s: %s' % (k, v[0:50]) for k, v in params.iteritems())) |
52 request = urllib.urlopen(url, urllib.urlencode(params)) | 53 request = urllib.urlopen(url, urllib.urlencode(params)) |
(...skipping 23 matching lines...) Expand all Loading... |
76 | 77 |
77 # Skip unit tests and we don't want anything from non-googler. | 78 # Skip unit tests and we don't want anything from non-googler. |
78 if (not 'test' in sys.modules['__main__'].__file__ and | 79 if (not 'test' in sys.modules['__main__'].__file__ and |
79 not 'NO_BREAKPAD' in os.environ and | 80 not 'NO_BREAKPAD' in os.environ and |
80 (socket.getfqdn().endswith('.google.com') or | 81 (socket.getfqdn().endswith('.google.com') or |
81 socket.getfqdn().endswith('.chromium.org'))): | 82 socket.getfqdn().endswith('.chromium.org'))): |
82 Register() | 83 Register() |
83 | 84 |
84 # Uncomment this line if you want to test it out. | 85 # Uncomment this line if you want to test it out. |
85 #Register() | 86 #Register() |
OLD | NEW |