Commit fa877020 authored by maruel@chromium.org's avatar maruel@chromium.org

Add some doc to breakpad.py and add support for NO_BREAKPAD environment variable.

TEST=none
BUG=none

Review URL: http://codereview.chromium.org/3311023

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@58982 0039d316-1c4b-4281-b951-d872f2087c98
parent c8f3cf80
......@@ -4,10 +4,17 @@
"""Breakpad for Python.
Sends a notification when a process stops on an exception."""
Sends a notification when a process stops on an exception.
It is only enabled when all these conditions are met:
1. hostname finishes with '.google.com'
2. main module name doesn't contain the word 'test'
3. no NO_BREAKPAD environment variable is defined
"""
import atexit
import getpass
import os
import urllib
import traceback
import socket
......@@ -33,6 +40,11 @@ def SendStack(last_tb, stack, url=None):
'exception': last_tb,
'host': socket.getfqdn(),
}
try:
# That may not always work.
params['exception'] = str(last_tb)
except:
pass
request = urllib.urlopen(url, urllib.urlencode(params))
print request.read()
request.close()
......@@ -60,7 +72,8 @@ def Register():
# Skip unit tests and we don't want anything from non-googler.
if (not 'test' in sys.modules['__main__'].__file__ and
socket.getfqdn().endswith('.google.com')):
socket.getfqdn().endswith('.google.com') and
not 'NO_BREAKPAD' in os.environ):
Register()
# Uncomment this line if you want to test it out.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment