Handle OSError: out of pty devices

This commit is contained in:
Sean Davis 2018-08-06 18:16:54 -04:00
parent fbe0a5bb6d
commit 0889105a68
1 changed files with 11 additions and 7 deletions

View File

@ -48,13 +48,17 @@ def check_dependencies(commands=[]):
return False return False
# Check for LANG requirements # Check for LANG requirements
child = env_spawn('sudo', ['-v'], 1) try:
if child.expect([".*ssword.*", "Sorry", child = env_spawn('sudo', ['-v'], 1)
pexpect.EOF, if child.expect([".*ssword.*", "Sorry",
pexpect.TIMEOUT]) == 3: pexpect.EOF,
global use_env pexpect.TIMEOUT]) == 3:
use_env = True global use_env
child.close() use_env = True
child.close()
except OSError:
child.close()
return False
# Check for sudo rights # Check for sudo rights
child = env_spawn('sudo', ['-v'], 1) child = env_spawn('sudo', ['-v'], 1)