stdout echo is on by default, add a parameter that lets us turn that off
if we want to.
---
iutil.py | 14 +++++++++-----
storage/dasd.py | 2 +-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/iutil.py b/iutil.py
index 0b15bd8..7086f2c 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.
diff --git a/storage/dasd.py b/storage/dasd.py
index 88f93f6..19b8488 100644
--- a/storage/dasd.py
+++ b/storage/dasd.py
@@ -140,7 +140,7 @@ class DASD:
iutil.execWithCallback("/sbin/dasdfmt", argv + [dasd],
stdout="/dev/tty5",
stderr="/dev/tty5",
callback=self._updateProgressWindow,
- callback_data=pw)
+ callback_data=pw, echo=False)
pw.pop()
else: