/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/trace.py

  • Committer: Jelmer Vernooij
  • Date: 2019-07-13 14:35:12 UTC
  • mto: This revision was merged to the branch mainline in revision 7372.
  • Revision ID: jelmer@jelmer.uk-20190713143512-doe3m0k208yko1oj
Don't crash when we are unable to create the cache directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
 
205
205
 
206
206
def _get_brz_log_filename():
 
207
    """Return the brz log filename.
 
208
 
 
209
    :return: A path to the log file
 
210
    :raise EnvironmentError: If the cache directory could not be created
 
211
    """
207
212
    brz_log = osutils.path_from_environ('BRZ_LOG')
208
213
    if brz_log:
209
214
        return brz_log
246
251
                break
247
252
        return os.fdopen(fd, 'ab', 0)  # unbuffered
248
253
 
249
 
    _brz_log_filename = _get_brz_log_filename()
250
 
    _rollover_trace_maybe(_brz_log_filename)
251
254
    try:
 
255
        _brz_log_filename = _get_brz_log_filename()
 
256
        _rollover_trace_maybe(_brz_log_filename)
 
257
 
252
258
        brz_log_file = _open_or_create_log_file(_brz_log_filename)
253
259
        brz_log_file.write(b'\n')
254
260
        if brz_log_file.tell() <= 2: