summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-09 03:33:07 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-09 03:33:07 +0000
commit1b5e84d45b1921359d8bc366c3da15cc5d82ab7a (patch)
tree1f0a4445eebca5500508b80b951cf3c8ea9ba667
parent1c833a03807f248c7655a0c8d7bbf86ae6c9ada1 (diff)
downloadportage-1b5e84d45b1921359d8bc366c3da15cc5d82ab7a.tar.gz
portage-1b5e84d45b1921359d8bc366c3da15cc5d82ab7a.tar.bz2
portage-1b5e84d45b1921359d8bc366c3da15cc5d82ab7a.zip
Bug #198491 - Disable termios.OPOST post-processing of output on
the slave pty file descriptor since otherwise weird things like \n -> \r\n transformations may occur. Thanks to Ulrich Mueller <ulm@gentoo.org> for this patch. svn path=/main/trunk/; revision=8473
-rw-r--r--pym/portage/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index f5ea0318a..40814d4b8 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -2616,6 +2616,13 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero
writemsg("openpty failed: '%s'\n" % str(e), noiselevel=1)
del e
master_fd, slave_fd = os.pipe()
+ if got_pty:
+ # Disable post-processing of output since otherwise weird
+ # things like \n -> \r\n transformations may occur.
+ import termios
+ mode = termios.tcgetattr(slave_fd)
+ mode[1] &= ~termios.OPOST
+ termios.tcsetattr(slave_fd, termios.TCSANOW, mode)
# We must set non-blocking mode before we close the slave_fd
# since otherwise the fcntl call can fail on FreeBSD (the child