~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/crash.py

  • Committer: Tarmac
  • Author(s): Vincent Ladeuil
  • Date: 2017-01-30 14:42:05 UTC
  • mfrom: (6620.1.1 trunk)
  • Revision ID: tarmac-20170130144205-r8fh2xpmiuxyozpv
Merge  2.7 into trunk including fix for bug #1657238 [r=vila]

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
 
18
17
"""Handling and reporting crashes.
19
18
 
20
19
A crash is an exception propagated up almost to the top level of Bazaar.
37
36
-Dno_apport.
38
37
"""
39
38
 
 
39
from __future__ import absolute_import
 
40
 
40
41
# for interactive testing, try the 'bzr assert-fail' command 
41
42
# or see http://code.launchpad.net/~mbp/bzr/bzr-fail
42
43
#
70
71
            return
71
72
    except ImportError, e:
72
73
        trace.mutter("couldn't find apport bug-reporting library: %s" % e)
73
 
        pass
74
74
    except Exception, e:
75
75
        # this should only happen if apport is installed but it didn't
76
76
        # work, eg because of an io error writing the crash file
77
 
        stderr.write("bzr: failed to report crash using apport:\n "
78
 
            "    %r\n" % e)
79
 
        pass
 
77
        trace.mutter("bzr: failed to report crash using apport: %r" % e)
 
78
        trace.log_exception_quietly()
80
79
    return report_bug_legacy(exc_info, stderr)
81
80
 
82
81
 
171
170
    pr['Platform'] = platform.platform(aliased=1)
172
171
    pr['UserEncoding'] = osutils.get_user_encoding()
173
172
    pr['FileSystemEncoding'] = sys.getfilesystemencoding()
174
 
    pr['Locale'] = os.environ.get('LANG')
 
173
    pr['Locale'] = os.environ.get('LANG', 'C')
175
174
    pr['BzrPlugins'] = _format_plugin_list()
176
175
    pr['PythonLoadedModules'] = _format_module_list()
177
176
    pr['BzrDebugFlags'] = pprint.pformat(debug.debug_flags)
260
259
        os.open(filename, 
261
260
            os.O_WRONLY|os.O_CREAT|os.O_EXCL,
262
261
            0600),
263
 
        'w')
 
262
        'wb')
264
263
 
265
264
 
266
265
def _format_plugin_list():