~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

Run postmortem debugger if BZR_PDB is set

Show diffs side-by-side

added added

removed removed

Lines of Context:
541
541
        finally:
542
542
            # do this here inside the exception wrappers to catch EPIPE
543
543
            sys.stdout.flush()
544
 
    except BzrCommandError, e:
545
 
        # command line syntax error, etc
546
 
        log_error(str(e))
547
 
        return 3
548
 
    except BzrError, e:
549
 
        bzrlib.trace.log_exception()
550
 
        return 3
551
 
    except AssertionError, e:
552
 
        bzrlib.trace.log_exception('assertion failed: ' + str(e))
553
 
        return 3
554
 
    except KeyboardInterrupt, e:
555
 
        bzrlib.trace.log_exception('interrupted')
556
 
        return 3
557
544
    except Exception, e:
 
545
        # used to handle AssertionError and KeyboardInterrupt
 
546
        # specially here, but hopefully they're handled ok by the logger now
558
547
        import errno
559
548
        if (isinstance(e, IOError) 
560
549
            and hasattr(e, 'errno')
562
551
            bzrlib.trace.note('broken pipe')
563
552
            return 3
564
553
        else:
565
 
            ## import pdb
566
 
            ## pdb.pm()
 
554
            if os.environ.get('BZR_PDB'):
 
555
                import pdb
 
556
                pdb.pm()
567
557
            bzrlib.trace.log_exception()
568
558
            return 3
569
559