On a Solaris 2.8 system, slave file descriptors are
left open after the child process is gone and the
master has been closed.
The pty.fork() function attempts to use os.forkpty()
first. When that fails (apparently the os module does
not provide forkpty() on Solaris?), it uses openpty()
and os.fork(). openpty() returns master and slave file
descriptors. Since pty.fork() only returns the
master_fd, it is not clear to me how the slave would
ever be closed since the caller doesn't have access to
it. Perhaps pty.fork is supposed to take care of this?
I am using pexpect to control my pty's, so I don't have
much expertise in this area other than what I've
gleaned from the code.
At any rate, on a long running process used to test
other programs, the open file descriptors pile up until
the ulimit is reached. I've worked around this by
modifying pexpect.close() to use os.close(self.child_fd
+ 1). A hack, I'm sure... :)
|