Permalink
Browse files

fixed file handle leak problem

  • Loading branch information...
1 parent 72cb00f commit a1e4d79a73e3c9bd0e275324a36ba8073b729cc9 @trey0 trey0 committed Aug 3, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 geocamPycroraptor/LocalTask.py
@@ -163,8 +163,14 @@ def start0(self, params={}, restart=0):
os.chdir(self._getConfig('workingDir'))
childStdoutReadFd, childStdoutWriteFd = self._openpty()
self._childStdout = Stdout(childStdoutReadFd, self._outLogger, self, 'stdout')
+ os.close(childStdoutReadFd) # close redundant fd after it is dup()'d by Stdout()
childStderrReadFd, childStderrWriteFd = self._openpty()
self._childStderr = Stdout(childStderrReadFd, self._errLogger, self, 'stderr')
+ os.close(childStderrReadFd)
+ allocatedFds = [self._childStdout._fileno, self._childStderr._fileno,
+ childStdoutWriteFd, childStderrWriteFd]
+ allocatedFds.sort()
+ print 'allocated fds: %s' % allocatedFds
childEnv = os.environ.copy()
for k, v in self._getConfig('env').iteritems():
if v == None:

0 comments on commit a1e4d79

Please sign in to comment.