SpawnProcess: remove obsolete fdopen
authorZac Medico <zmedico@gentoo.org>
Fri, 16 Dec 2011 19:18:20 +0000 (11:18 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 16 Dec 2011 19:18:20 +0000 (11:18 -0800)
Since commit 30d2d0a9db486c5a70848ad5d27b37a3ec48f271, we use os.read()
due to bugs in array.fromfile(), so there's no need to use fdopen.

pym/_emerge/SpawnProcess.py

index c2f4928734c7e6b9d7ec0e00dff5c4f50c525459..9f83ef0dee78cbeaf815ced5b79603d015149ba2 100644 (file)
@@ -46,6 +46,7 @@ class SpawnProcess(SubProcess):
                master_fd, slave_fd = self._pipe(fd_pipes)
                fcntl.fcntl(master_fd, fcntl.F_SETFL,
                        fcntl.fcntl(master_fd, fcntl.F_GETFL) | os.O_NONBLOCK)
+               files.process = master_fd
 
                logfile = None
                if self._can_log(slave_fd):
@@ -75,9 +76,6 @@ class SpawnProcess(SubProcess):
                        if fd == sys.stderr.fileno():
                                sys.stderr.flush()
 
-               # WARNING: It is very important to use unbuffered mode here,
-               # in order to avoid issue 5380 with python3.
-               files.process = os.fdopen(master_fd, 'rb', 0)
                if logfile is not None:
 
                        fd_pipes_orig = fd_pipes.copy()
@@ -120,7 +118,7 @@ class SpawnProcess(SubProcess):
                kwargs["returnpid"] = True
                kwargs.pop("logfile", None)
 
-               self._reg_id = self.scheduler.register(files.process.fileno(),
+               self._reg_id = self.scheduler.register(files.process,
                        self._registered_events, output_handler)
                self._registered = True