/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 bzrlib/osutils.py

  • Committer: Parth Malwankar
  • Date: 2010-03-11 06:35:52 UTC
  • mfrom: (5082 +trunk)
  • mto: (5094.3.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5107.
  • Revision ID: parth.malwankar@gmail.com-20100311063552-4smanr68su2hsw46
mergedĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1351
1351
    normalized_filename = _inaccessible_normalized_filename
1352
1352
 
1353
1353
 
 
1354
def set_signal_handler(signum, handler, restart_syscall=True):
 
1355
    """A wrapper for signal.signal that also calls siginterrupt(signum, False)
 
1356
    on platforms that support that.
 
1357
 
 
1358
    :param restart_syscall: if set, allow syscalls interrupted by a signal to
 
1359
        automatically restart (by calling `signal.siginterrupt(signum,
 
1360
        False)`).  May be ignored if the feature is not available on this
 
1361
        platform or Python version.
 
1362
    """
 
1363
    old_handler = signal.signal(signum, handler)
 
1364
    if restart_syscall:
 
1365
        try:
 
1366
            siginterrupt = signal.siginterrupt
 
1367
        except AttributeError: # siginterrupt doesn't exist on this platform, or for this version of
 
1368
            # Python.
 
1369
            pass
 
1370
        else:
 
1371
            siginterrupt(signum, False)
 
1372
    return old_handler
 
1373
 
 
1374
 
1354
1375
default_terminal_width = 80
1355
1376
"""The default terminal width for ttys.
1356
1377
 
1458
1479
            # the current design -- vila 20091216
1459
1480
            pass
1460
1481
        else:
1461
 
            signal.signal(signal.SIGWINCH, _terminal_size_changed)
 
1482
            set_signal_handler(signal.SIGWINCH, _terminal_size_changed)
1462
1483
        _registered_sigwinch = True
1463
1484
 
1464
1485