~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

[patch] handle bad IOError subclass raised by urlopen

Show diffs side-by-side

added added

removed removed

Lines of Context:
510
510
    return ret or 0
511
511
 
512
512
def display_command(func):
 
513
    """Decorator that suppresses pipe/interrupt errors."""
513
514
    def ignore_pipe(*args, **kwargs):
514
515
        try:
515
516
            result = func(*args, **kwargs)
516
517
            sys.stdout.flush()
517
518
            return result
518
519
        except IOError, e:
 
520
            if not hasattr(e, 'errno'):
 
521
                raise
519
522
            if e.errno != errno.EPIPE:
520
523
                raise
 
524
            pass
521
525
        except KeyboardInterrupt:
522
526
            pass
523
527
    return ignore_pipe