From 0889105a68fdd49d56846849ec1fb02a910ef49a Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Mon, 6 Aug 2018 18:16:54 -0400 Subject: [PATCH] Handle OSError: out of pty devices --- mugshot_lib/SudoDialog.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/mugshot_lib/SudoDialog.py b/mugshot_lib/SudoDialog.py index 2eeffe6..7991fa5 100644 --- a/mugshot_lib/SudoDialog.py +++ b/mugshot_lib/SudoDialog.py @@ -48,13 +48,17 @@ def check_dependencies(commands=[]): return False # Check for LANG requirements - child = env_spawn('sudo', ['-v'], 1) - if child.expect([".*ssword.*", "Sorry", - pexpect.EOF, - pexpect.TIMEOUT]) == 3: - global use_env - use_env = True - child.close() + try: + child = env_spawn('sudo', ['-v'], 1) + if child.expect([".*ssword.*", "Sorry", + pexpect.EOF, + pexpect.TIMEOUT]) == 3: + global use_env + use_env = True + child.close() + except OSError: + child.close() + return False # Check for sudo rights child = env_spawn('sudo', ['-v'], 1)