Handle invalid file descriptor in exit
This commit is contained in:
parent
9653254094
commit
563083cf86
|
@ -369,8 +369,12 @@ def exit():
|
||||||
## close file handles
|
## close file handles
|
||||||
if sys.platform == 'darwin':
|
if sys.platform == 'darwin':
|
||||||
for fd in range(3, 4096):
|
for fd in range(3, 4096):
|
||||||
if fd not in [7]: # trying to close 7 produces an illegal instruction on the Mac.
|
if fd in [7]: # trying to close 7 produces an illegal instruction on the Mac.
|
||||||
|
continue
|
||||||
|
try:
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
else:
|
else:
|
||||||
os.closerange(3, 4096) ## just guessing on the maximum descriptor count..
|
os.closerange(3, 4096) ## just guessing on the maximum descriptor count..
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user