diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-02-14 17:17:04 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-02-14 17:17:04 -0800 |
commit | b1adb04939ce95ed522934e81c064046f6047c84 (patch) | |
tree | ba25f47bb12a7659e61e5ccea205a2def6bf2b46 | |
parent | 2854a67644252fa1133f7f2720b1811b2c3f10fb (diff) | |
download | portage-b1adb04939ce95ed522934e81c064046f6047c84.tar.gz portage-b1adb04939ce95ed522934e81c064046f6047c84.tar.bz2 portage-b1adb04939ce95ed522934e81c064046f6047c84.zip |
SpawnProcess: for stdout use os.write, not fdopen
-rw-r--r-- | pym/_emerge/SpawnProcess.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py index 3e8945b86..05c4768d4 100644 --- a/pym/_emerge/SpawnProcess.py +++ b/pym/_emerge/SpawnProcess.py @@ -91,7 +91,7 @@ class SpawnProcess(SubProcess): mode=0o660) if not self.background: - files.stdout = os.fdopen(os.dup(fd_pipes_orig[1]), 'wb') + files.stdout = os.dup(fd_pipes_orig[1]) output_handler = self._output_handler @@ -180,11 +180,10 @@ class SpawnProcess(SubProcess): while True: try: if not write_successful: - files.stdout.write(buf) + os.write(files.stdout, buf) write_successful = True - files.stdout.flush() break - except IOError as e: + except OSError as e: if e.errno != errno.EAGAIN: raise del e @@ -206,8 +205,8 @@ class SpawnProcess(SubProcess): # inherit stdio file descriptors from portage # (maybe it can't be avoided with # PROPERTIES=interactive). - fcntl.fcntl(files.stdout.fileno(), fcntl.F_SETFL, - fcntl.fcntl(files.stdout.fileno(), + fcntl.fcntl(files.stdout, fcntl.F_SETFL, + fcntl.fcntl(files.stdout, fcntl.F_GETFL) ^ os.O_NONBLOCK) files.log.write(buf) |