Resolves: rhbz#677605 --- anaconda | 37 ++++++++++++++++--------------------- iutil.py | 14 ++++++++++---- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/anaconda b/anaconda index 1e32373..945b7e8 100755 --- a/anaconda +++ b/anaconda @@ -45,20 +45,20 @@ def AnacondaShowWarning(message, category, filename, lineno, file=sys.stderr, li def startMetacityWM(): childpid = os.fork() if not childpid: - cmd = '/usr/bin/metacity' - if not os.access(cmd, os.X_OK): - log.error("Unable to find the window manager binary.") + # after this point the method should never return (or throw an exception + # outside) + try: + args = ['--display', ':1', + '--sm-disable'] + iutil.execWithRedirect('metacity', args, + stdout='/dev/null', stderr='/dev/null') + except BaseException as e: + # catch all possible exceptions + log.error("Problems running the window manager: %s" % str(e)) sys.exit(1) - args = ['--display', ':1', - '--sm-disable'] - rc = iutil.execWithRedirect(cmd, args, - stdout='/dev/null', stderr='/dev/null') - if rc: - log.error("Error running window manager.") - sys.exit (rc) - else: - log.info("The window manager has terminated.") - sys.exit(0) + + log.info("The window manager has terminated.") + sys.exit(0) return childpid def startAuditDaemon(): @@ -75,18 +75,13 @@ def startAuditDaemon(): # function to handle X startup special issues for anaconda def doStartupX11Actions(): - global wm_pid + global wm_pid # pid of the anaconda fork where the window manager is running setupGraphicalLinks() # now start up the window manager - try: - wm_pid = startMetacityWM() - log.info("Started window manager, pid %s." % (wm_pid,)) - - except: - wm_pid = None - log.error("Unable to start the window manager.") + wm_pid = startMetacityWM() + log.info("Starting window manager, pid %s." % (wm_pid,)) if wm_pid is not None: import xutils diff --git a/iutil.py b/iutil.py index ae62c7c..f6f359f 100644 --- a/iutil.py +++ b/iutil.py @@ -42,16 +42,22 @@ program_log = logging.getLogger("program") #Python reimplementation of the shell tee process, so we can #feed the pipe output into two places at the same time class tee(threading.Thread): - def __init__(self, inputdesc, outputdesc, logmethod): + def __init__(self, inputdesc, outputdesc, logmethod, command): threading.Thread.__init__(self) self.inputdesc = os.fdopen(inputdesc, "r") self.outputdesc = outputdesc self.logmethod = logmethod self.running = True + self.command = command def run(self): while self.running: - data = self.inputdesc.readline() + try: + data = self.inputdesc.readline() + except IOError: + self.logmethod("Can't read from pipe during a call to %s. " + "(program terminated suddenly?)" % self.command) + break if data == "": self.running = False else: @@ -119,8 +125,8 @@ def execWithRedirect(command, argv, stdin = None, stdout = None, try: #prepare tee proceses - proc_std = tee(pstdout, stdout, program_log.info) - proc_err = tee(perrout, stderr, program_log.error) + proc_std = tee(pstdout, stdout, program_log.info, command) + proc_err = tee(perrout, stderr, program_log.error, command) #start monitoring the outputs proc_std.start() -- 1.7.3.3 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list