From 77cb4022c981c3c6ba96533a55058a643f60d334 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 22 Aug 2012 12:46:04 -0700 Subject: Use sys.__std*.fileno() in case of overrides. This fixes AttributeError exceptions for API consumers that override sys.std* streams pseudo-file objects. --- bin/dispatch-conf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bin/dispatch-conf') diff --git a/bin/dispatch-conf b/bin/dispatch-conf index 139a001e8..35979dbb2 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -1,5 +1,5 @@ #!/usr/bin/python -O -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @@ -463,10 +463,12 @@ if not shell or not os.access(shell, os.EX_OK): def spawn_shell(cmd): if shell: + sys.__stdout__.flush() + sys.__stderr__.flush() spawn([shell, "-c", cmd], env=os.environ, - fd_pipes = { 0 : sys.stdin.fileno(), - 1 : sys.stdout.fileno(), - 2 : sys.stderr.fileno()}) + fd_pipes = { 0 : sys.__stdin__.fileno(), + 1 : sys.__stdout__.fileno(), + 2 : sys.__stderr__.fileno()}) else: os.system(cmd) -- cgit v1.2.3-1-g7c22