@ -10,12 +10,15 @@ import atexit
import getpass
import getpass
import urllib
import urllib
import traceback
import traceback
import socket
import sys
import sys
def SendStack ( stack , url = ' http://chromium-status.appspot.com/breakpad ' ) :
def SendStack ( stack , url = ' http://chromium-status.appspot.com/breakpad ' ) :
print ' Do you want to send a crash report [y/N]? ' ,
print ' Do you want to send a crash report [y/N]? ' ,
if sys . stdin . read ( 1 ) . lower ( ) == ' y ' :
if sys . stdin . read ( 1 ) . lower ( ) != ' y ' :
return
print ' Sending crash report ... '
try :
try :
params = {
params = {
' args ' : sys . argv ,
' args ' : sys . argv ,
@ -29,11 +32,13 @@ def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
print ( ' There was a failure while trying to send the stack trace. Too bad. ' )
print ( ' There was a failure while trying to send the stack trace. Too bad. ' )
#@atexit.register
def CheckForException ( ) :
def CheckForException ( ) :
if ' test ' in sys . modules [ ' __main__ ' ] . __file__ :
# Probably a unit test.
return
last_tb = getattr ( sys , ' last_traceback ' , None )
last_tb = getattr ( sys , ' last_traceback ' , None )
if last_tb :
if last_tb :
SendStack ( ' ' . join ( traceback . format_tb ( 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 )