~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

(mbp) Register SIGWINCH only when creating a TextUIFactory

Show diffs side-by-side

added added

removed removed

Lines of Context:
1438
1438
    if width is not None:
1439
1439
        os.environ['COLUMNS'] = str(width)
1440
1440
 
1441
 
if sys.platform == 'win32':
1442
 
    # Martin (gz) mentioned WINDOW_BUFFER_SIZE_RECORD from ReadConsoleInput but
1443
 
    # I've no idea how to plug that in the current design -- vila 20091216
1444
 
    pass
1445
 
else:
1446
 
    signal.signal(signal.SIGWINCH, _terminal_size_changed)
 
1441
 
 
1442
_registered_sigwinch = False
 
1443
 
 
1444
def watch_sigwinch():
 
1445
    """Register for SIGWINCH, once and only once."""
 
1446
    global _registered_sigwinch
 
1447
    if not _registered_sigwinch:
 
1448
        if sys.platform == 'win32':
 
1449
            # Martin (gz) mentioned WINDOW_BUFFER_SIZE_RECORD from
 
1450
            # ReadConsoleInput but I've no idea how to plug that in
 
1451
            # the current design -- vila 20091216
 
1452
            pass
 
1453
        else:
 
1454
            signal.signal(signal.SIGWINCH, _terminal_size_changed)
 
1455
        _registered_sigwinch = True
1447
1456
 
1448
1457
 
1449
1458
def supports_executable():