Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Side by Side Diff: breakpad.py

Issue 444009: Minimalist breakpad implementation. (Closed)
Patch Set: Default to opt-out Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | drover.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 """Breakpad for Python.
6
7 Sends a notification when a process stops on an exception."""
8
9 import atexit
10 import getpass
11 import urllib
12 import traceback
13 import sys
14
15
16 def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
17 print 'Do you want to send a crash report [y/N]? ',
18 if sys.stdin.read(1).lower() == 'y':
19 try:
20 params = {
21 'args': sys.argv,
22 'stack': stack,
23 'user': getpass.getuser(),
24 }
25 request = urllib.urlopen(url, urllib.urlencode(params))
26 print request.read()
27 request.close()
28 except IOError:
29 print('There was a failure while trying to send the stack trace. Too bad.' )
30
31
32 @atexit.register
33 def CheckForException():
34 if 'test' in sys.modules['__main__'].__file__:
35 # Probably a unit test.
36 return
37 last_tb = getattr(sys, 'last_traceback', None)
38 if last_tb:
39 SendStack(''.join(traceback.format_tb(last_tb)))
OLDNEW
« no previous file with comments | « no previous file | drover.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698