summaryrefslogtreecommitdiffstats
path: root/iutil.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-10-30 10:34:14 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-11-02 14:35:27 -1000
commit53e90adccefb2c117cfc6addb154a698dfff5110 (patch)
treece7701b90e4a11fb2668470dcbd84b45e907d657 /iutil.py
parent5324c6b7876fd92b4c635f9d34df148bbcd1cff7 (diff)
downloadanaconda-53e90adccefb2c117cfc6addb154a698dfff5110.tar.gz
anaconda-53e90adccefb2c117cfc6addb154a698dfff5110.tar.xz
anaconda-53e90adccefb2c117cfc6addb154a698dfff5110.zip
In execWithCallback(), support disabling stdout echo (#528386)
stdout echo is on by default, add a parameter that lets us turn that off if we want to.
Diffstat (limited to 'iutil.py')
-rw-r--r--iutil.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/iutil.py b/iutil.py
index 36f14d334..7912bbf4b 100644
--- a/iutil.py
+++ b/iutil.py
@@ -243,8 +243,8 @@ def execWithCapture(command, argv, stdin = None, stderr = None, root='/'):
return rc
def execWithCallback(command, argv, stdin = None, stdout = None,
- stderr = None, callback = None, callback_data = None,
- root = '/'):
+ stderr = None, echo = True, callback = None,
+ callback_data = None, root = '/'):
def chroot():
os.chroot(root)
@@ -310,8 +310,11 @@ def execWithCallback(command, argv, stdin = None, stdout = None,
if e.errno != 4:
raise IOError, e.args
- os.write(stdout, s)
+ if echo:
+ os.write(stdout, s)
+
runningLog.write(s)
+
if callback:
callback(s, callback_data=callback_data)
@@ -349,9 +352,10 @@ def _pulseProgressCallback(data, callback_data=None):
callback_data.pulse()
def execWithPulseProgress(command, argv, stdin = None, stdout = None,
- stderr = None, progress = None, root = '/'):
+ stderr = None, echo = True, progress = None,
+ root = '/'):
execWithCallback(command, argv, stdin=stdin, stdout=stdout,
- stderr=stderr, callback=_pulseProgressCallback,
+ stderr=stderr, echo=echo, callback=_pulseProgressCallback,
callback_data=progress, root=root)
## Run a shell.