Bug 815 - waf shell file descriptor leak. Patch by Tom Goff, slightly modified.

Gustavo J. A. M. Carneiro 2010-02-15 14:58:45 +00:00
parent b94ec61cc1
commit 37be8d39e0
1 changed files with 11 additions and 0 deletions

View File

@ -31,6 +31,17 @@ if sys.platform == 'win32':
else:
dev_null = open("/dev/null", "w")
fcntl = fd = fl = None
try:
import fcntl
except ImportError:
pass
else:
fd = dev_null.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD, fl | fcntl.FD_CLOEXEC)
del fcntl, fd, fl
def _open_out_file(filename):
if filename in ['NUL:', '/dev/null']:
return dev_null