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

Unified Diff: breakpad.py

Issue 460044: Add a check so non-google employee don't send crash dumps. (Closed)
Patch Set: Change test to be on process start instead of process shutdown 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: breakpad.py
diff --git a/breakpad.py b/breakpad.py
index 8efe82a9a285515301e1e60b52063d2ff04eeb38..003f9ad887da9bb6b24416f184ed5eb1a204890f 100644
--- a/breakpad.py
+++ b/breakpad.py
@@ -10,30 +10,35 @@ import atexit
import getpass
import urllib
import traceback
+import socket
import sys
def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
print 'Do you want to send a crash report [y/N]? ',
- if sys.stdin.read(1).lower() == 'y':
- try:
- params = {
- 'args': sys.argv,
- 'stack': stack,
- 'user': getpass.getuser(),
- }
- request = urllib.urlopen(url, urllib.urlencode(params))
- print request.read()
- request.close()
- except IOError:
- print('There was a failure while trying to send the stack trace. Too bad.')
-
-
-#@atexit.register
-def CheckForException():
- if 'test' in sys.modules['__main__'].__file__:
- # Probably a unit test.
+ if sys.stdin.read(1).lower() != 'y':
return
+ print 'Sending crash report ...'
+ try:
+ params = {
+ 'args': sys.argv,
+ 'stack': stack,
+ 'user': getpass.getuser(),
+ }
+ request = urllib.urlopen(url, urllib.urlencode(params))
+ print request.read()
+ request.close()
+ except IOError:
+ print('There was a failure while trying to send the stack trace. Too bad.')
+
+
+def CheckForException():
last_tb = getattr(sys, 'last_traceback', None)
if last_tb:
SendStack(''.join(traceback.format_tb(last_tb)))
+
+
+if (not 'test' in sys.modules['__main__'].__file__ and
+ socket.gethostname().endswith('.google.com')):
+ # Skip unit tests and we don't want anything from non-googler.
+ atexit.register(CheckForException)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698