Re: [PATCH 1/3] In execWithCallback(), support disabling stdout echo (#528386)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Have you checked all callers that they use keyword args, because if they
don't then adding a new argument in the middle of the list may be a problem?

Regards,

Hans


On 10/31/2009 12:20 AM, David Cantrell wrote:
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:

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux