commit:     e9cd44dbd0366267b8b6beb011d91a9f99fed3cd
Author:     Peter Foley <pefoley2 <AT> pefoley <DOT> com>
AuthorDate: Wed Apr 12 06:48:48 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Apr 12 16:43:52 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e9cd44db

Prevent crash if os.nice() fails

If settings["PORTAGE_NICENESS"] is undefined, portage crashes with a
KeyError when trying to print the error.

Signed-off-by: Peter Foley <pefoley2 <AT> pefoley.com>
X-Gentoo-bug: 615328
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=615328

 pym/_emerge/actions.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 818fab90a..1bc20c3ed 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2553,7 +2553,7 @@ def nice(settings):
        except (OSError, ValueError) as e:
                out = portage.output.EOutput()
                out.eerror("Failed to change nice value to '%s'" % \
-                       settings["PORTAGE_NICENESS"])
+                       settings.get("PORTAGE_NICENESS", "0"))
                out.eerror("%s\n" % str(e))
 
 def ionice(settings):

Reply via email to