comparison mxtool/mx.py @ 15898:c102edf38127

mx: prevent CTRL-C from being blocked while subprocess is running (re-applied without unrelated changes)
author Doug Simon <doug.simon@oracle.com>
date Mon, 26 May 2014 12:55:17 +0200
parents c5f57314599d
children e065b9746246
comparison
equal deleted inserted replaced
15897:c5f57314599d 15898:c102edf38127
1523 if callable(err): 1523 if callable(err):
1524 t = Thread(target=redirect, args=(p.stderr, err)) 1524 t = Thread(target=redirect, args=(p.stderr, err))
1525 # Don't make the reader thread a daemon otherwise output can be droppped 1525 # Don't make the reader thread a daemon otherwise output can be droppped
1526 t.start() 1526 t.start()
1527 joiners.append(t) 1527 joiners.append(t)
1528 for t in joiners: 1528 while any([t.is_alive() for t in joiners]):
1529 t.join() 1529 # Need to use timeout otherwise all signals (including CTRL-C) are blocked
1530 # see: http://bugs.python.org/issue1167930
1531 for t in joiners:
1532 t.join(10)
1530 if timeout is None or timeout == 0: 1533 if timeout is None or timeout == 0:
1531 retcode = waitOn(p) 1534 retcode = waitOn(p)
1532 else: 1535 else:
1533 if get_os() == 'windows': 1536 if get_os() == 'windows':
1534 abort('Use of timeout not (yet) supported on Windows') 1537 abort('Use of timeout not (yet) supported on Windows')