~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Vincent Ladeuil
  • Date: 2009-12-16 10:54:55 UTC
  • mfrom: (4747.5.3 316357-SIGWINCH)
  • mto: This revision was merged to the branch mainline in revision 4902.
  • Revision ID: v.ladeuil+lp@free.fr-20091216105455-c1knt5e61o177gg2
Catch SIGWINCH on Unices

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
from shutil import (
40
40
    rmtree,
41
41
    )
 
42
import signal
42
43
import subprocess
43
44
import tempfile
44
45
from tempfile import (
1427
1428
    _terminal_size = _ioctl_terminal_size
1428
1429
 
1429
1430
 
 
1431
def _terminal_size_changed(signum, frame):
 
1432
    """Set COLUMNS upon receiving a SIGnal for WINdow size CHange."""
 
1433
    width, height = _terminal_size(None, None)
 
1434
    if width is not None:
 
1435
        os.environ['COLUMNS'] = str(width)
 
1436
 
 
1437
if sys.platform == 'win32':
 
1438
    # Martin (gz) mentioned WINDOW_BUFFER_SIZE_RECORD from ReadConsoleInput but
 
1439
    # I've no idea how to plug that in the current design -- vila 20091216
 
1440
    pass
 
1441
else:
 
1442
    signal.signal(signal.SIGWINCH, _terminal_size_changed)
 
1443
 
 
1444
 
1430
1445
def supports_executable():
1431
1446
    return sys.platform != "win32"
1432
1447