On Wed, 2009-01-07 at 09:34 +0100, Hans de Goede wrote: > Hi, > > You are changing the behavior of execWithCapture, you are now also capturing > the stderr output! Good catch. I fixed this in 5.3 but forgot to bring it back after F10. Here's the patch: diff --git a/iutil.py b/iutil.py index a749fc2..7a1ed8e 100644 --- a/iutil.py +++ b/iutil.py @@ -96,7 +96,7 @@ def execWithCapture(command, argv, stdin = 0, stderr = 2, root try: pipe = subprocess.Popen([command] + argv, stdin=stdin, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, + stderr=stderr, preexec_fn=chroot, cwd=root) except OSError, (errno, msg): log.error ("Error running " + command + ": " + msg) Dave > > Other then that I like it. > > Regards, > > Hans > > > > Chris Lumens wrote: > > --- > > exception.py | 1 + > > iutil.py | 51 +++++++++++++++++++++++++++++++++++++++++++-------- > > 2 files changed, 44 insertions(+), 8 deletions(-) > > > > diff --git a/exception.py b/exception.py > > index 74a958d..214ca87 100644 > > --- a/exception.py > > +++ b/exception.py > > @@ -223,6 +223,7 @@ class AnacondaExceptionDump: > > > > for file in ("/tmp/syslog", "/tmp/anaconda.log", > > "/tmp/lvmout", "/tmp/resize.out", > > + "/tmp/program.log", > > anaconda.rootPath + "/root/install.log", > > anaconda.rootPath + "/root/upgrade.log"): > > try: > > diff --git a/iutil.py b/iutil.py > > index a749fc2..46725eb 100644 > > --- a/iutil.py > > +++ b/iutil.py > > @@ -59,18 +59,38 @@ def execWithRedirect(command, argv, stdin = 0, stdout = 1, stderr = 2, > > if type(stderr) == type("string"): > > stderr = open(stderr, "w") > > > > + runningLog = open("/tmp/program.log", "a") > > + runningLog.write("Running... %s\n" % ([command] + argv,)) > > + > > if stdout is not None and type(stdout) != int: > > stdout.write("Running... %s\n" %([command] + argv,)) > > > > try: > > - proc = subprocess.Popen([command] + argv, stdin=stdin, stdout=stdout, > > - stderr=stderr, preexec_fn=chroot, cwd=root) > > - ret = proc.wait() > > + proc = subprocess.Popen([command] + argv, stdin=stdin, > > + stdout=subprocess.PIPE, > > + stderr=subprocess.PIPE, > > + preexec_fn=chroot, cwd=root) > > + > > + while True: > > + (outStr, errStr) = proc.communicate() > > + if outStr: > > + stdout.write(outStr) > > + runningLog.write(outStr) > > + if errStr: > > + stderr.write(errStr) > > + runningLog.write(errStr) > > + > > + if proc.returncode is not None: > > + ret = proc.returncode > > + break > > except OSError, (errno, msg): > > errstr = "Error running %s: %s" % (command, msg) > > - log.error (errstr) > > + log.error(errstr) > > + runningLog.write(errstr) > > + runningLog.close() > > raise RuntimeError, errstr > > > > + runningLog.close() > > return ret > > > > ## Run an external program and capture standard out. > > @@ -84,6 +104,8 @@ def execWithCapture(command, argv, stdin = 0, stderr = 2, root='/'): > > def chroot(): > > os.chroot(root) > > > > + rc = "" > > + > > argv = list(argv) > > if type(stdin) == type("string"): > > if os.access(stdin, os.R_OK): > > @@ -93,17 +115,30 @@ def execWithCapture(command, argv, stdin = 0, stderr = 2, root='/'): > > if type(stderr) == type("string"): > > stderr = open(stderr, "w") > > > > + runningLog = open("/tmp/program.log", "a") > > + runningLog.write("Running... %s\n" % ([command] + argv,)) > > + > > try: > > - pipe = subprocess.Popen([command] + argv, stdin=stdin, > > + proc = subprocess.Popen([command] + argv, stdin=stdin, > > stdout=subprocess.PIPE, > > - stderr=subprocess.STDOUT, > > + stderr=subprocess.PIPE, > > preexec_fn=chroot, cwd=root) > > + > > + while True: > > + (outStr, errStr) = proc.communicate() > > + if outStr: > > + runningLog.write(outStr) > > + rc += outStr > > + if errStr: > > + runningLog.write(errStr) > > + rc += errStr > > + > > + if proc.returncode is not None: > > + break > > except OSError, (errno, msg): > > log.error ("Error running " + command + ": " + msg) > > raise RuntimeError, "Error running " + command + ": " + msg > > > > - rc = pipe.stdout.read() > > - pipe.wait() > > return rc > > > > def execWithPulseProgress(command, argv, stdin = 0, stdout = 1, stderr = 2, > > _______________________________________________ > Anaconda-devel-list mailing list > Anaconda-devel-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/anaconda-devel-list _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list