-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.AsynchronousLock import AsynchronousLock
import sys
import portage
from portage import os
+from portage.util._pty import _create_pty_or_pipe
if sys.hexversion >= 0x3000000:
long = int
self.env = fetch_env
SpawnProcess._start(self)
+ def _pipe(self, fd_pipes):
+ """When appropriate, use a pty so that fetcher progress bars,
+ like wget has, will work properly."""
+ if self.background or not sys.stdout.isatty():
+ # When the output only goes to a log file,
+ # there's no point in creating a pty.
+ return os.pipe()
+ stdout_pipe = None
+ if not self.background:
+ stdout_pipe = fd_pipes.get(1)
+ got_pty, master_fd, slave_fd = \
+ _create_pty_or_pipe(copy_term_size=stdout_pipe)
+ return (master_fd, slave_fd)
+
def _set_returncode(self, wait_retval):
SpawnProcess._set_returncode(self, wait_retval)
if not self.pretend and self.returncode == os.EX_OK: