diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-11-20 20:05:12 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-11-20 20:05:12 +0000 |
commit | 3f07d0d007a7c00362261495724f599a8f5991e8 (patch) | |
tree | 002bd60a87a8025db557211c2e391af976ba065f | |
parent | 6a2686391de52d74eb3fe8187835e691303ebd8e (diff) | |
download | portage-3f07d0d007a7c00362261495724f599a8f5991e8.tar.gz portage-3f07d0d007a7c00362261495724f599a8f5991e8.tar.bz2 portage-3f07d0d007a7c00362261495724f599a8f5991e8.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. (trunk r8473)
svn path=/main/branches/2.1.2/; revision=8550
-rw-r--r-- | pym/portage.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 254ae0b1a..e25c85678 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -2567,6 +2567,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 |