[master] abnormal_exit() method that doesn't forget about switching to tty1.

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

 



Also fixes #577380 for rawhide.
---
 constants.py        |    2 ++
 exception.py        |    7 ++-----
 iutil.py            |   10 ++++++++++
 storage/__init__.py |    2 +-
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/constants.py b/constants.py
index fb81c90..cfced0b 100644
--- a/constants.py
+++ b/constants.py
@@ -27,6 +27,8 @@ BETANAG = 1
 
 SELINUX_DEFAULT = 1
 
+DEFAULT_ABNORMAL_RC = 1
+
 DISPATCH_BACK = -1
 DISPATCH_FORWARD = 1
 DISPATCH_NOOP = None
diff --git a/exception.py b/exception.py
index 2c6bc2d..35dcebf 100644
--- a/exception.py
+++ b/exception.py
@@ -24,6 +24,7 @@
 from meh.handler import *
 from meh.dump import *
 import isys
+import iutil
 import sys
 import os
 import shutil
@@ -91,11 +92,7 @@ class AnacondaExceptionHandler(ExceptionHandler):
 
     def runQuit(self, (ty, value, tb)):
         # see a similar comment at runDebug()
-        try:
-            isys.vtActivate(1)
-        except SystemError:
-            pass
-        sys.exit(self.exitcode)
+        iutil.abnormal_exit(self.exitcode)
 
 def initExceptionHandling(anaconda):
     fileList = [ "/tmp/anaconda.log", "/tmp/lvmout", "/tmp/resize.out",
diff --git a/iutil.py b/iutil.py
index e1cde5e..ae8a4da 100644
--- a/iutil.py
+++ b/iutil.py
@@ -35,6 +35,7 @@ import threading
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 
+import isys
 import logging
 log = logging.getLogger("anaconda")
 program_log = logging.getLogger("program")
@@ -379,6 +380,15 @@ def execConsole():
     except OSError as e:
         raise RuntimeError, "Error running /bin/sh: " + e.strerror
 
+def abnormal_exit(rc=DEFAULT_ABNORMAL_RC):
+    """The preferred way to end the installer after an error."""
+    # vtActivate does not work on certain ppc64 machines
+    try:
+        isys.vtActivate(1)
+    except SystemError:
+        pass
+    sys.exit(rc)
+
 ## Get the size of a directory and all its subdirectories.
 # @param dir The name of the directory to find the size of.
 # @return The size of the directory in kilobytes.
diff --git a/storage/__init__.py b/storage/__init__.py
index e37f9e9..05d076f 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -105,7 +105,7 @@ def storageInitialize(anaconda):
                       "could not be found.  Please check your "
                       "parameters and try again.") % devspec,
                     type="custom", custom_buttons = [_("_Exit installer")])
-                sys.exit(1)
+                iutil.abnormal_exit()
     else:
         storage.reset()
 
-- 
1.6.6

_______________________________________________
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