FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 10-30-2009, 10:20 PM
David Cantrell
 
Default 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.
---
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:
--
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:15 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org