Dont use closerange() on OS X

The original motivation for this was OpenGL problems caused by the glfw
library on linux because of inherited file descriptors. Dont know if
that applies on OS X.
This commit is contained in:
Kovid Goyal 2017-01-11 15:39:10 +05:30
parent 426f960b23
commit 18a1a61ec2

View File

@ -9,7 +9,7 @@ import fcntl
import signal import signal
from threading import Thread from threading import Thread
from .constants import terminfo_dir from .constants import terminfo_dir, isosx
def remove_cloexec(fd): def remove_cloexec(fd):
@ -52,6 +52,7 @@ class Child:
else: else:
os.dup2(slave, i) os.dup2(slave, i)
os.close(slave), os.close(master) os.close(slave), os.close(master)
if not isosx: # Apparently some OS X systemlibraries open file descriptors that cause EXC_GUARD crashes when closed
os.closerange(3, 200) os.closerange(3, 200)
# Establish the controlling terminal (see man 7 credentials) # Establish the controlling terminal (see man 7 credentials)
os.close(os.open(os.ttyname(1), os.O_RDWR)) os.close(os.open(os.ttyname(1), os.O_RDWR))