Fixes from checkers to work around missing user definitions
This commit is contained in:
parent
bf7b413487
commit
ce0bedc3cf
|
@ -21,7 +21,10 @@ def get_default_cwd():
|
||||||
"""Determine a reasonable default cwd"""
|
"""Determine a reasonable default cwd"""
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
if not os.path.exists(cwd) or not os.path.isdir(cwd):
|
if not os.path.exists(cwd) or not os.path.isdir(cwd):
|
||||||
|
try:
|
||||||
cwd = pwd.getpwuid(os.getuid())[5]
|
cwd = pwd.getpwuid(os.getuid())[5]
|
||||||
|
except KeyError:
|
||||||
|
cwd = '/'
|
||||||
|
|
||||||
return(cwd)
|
return(cwd)
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,11 @@ def path_lookup(command):
|
||||||
|
|
||||||
def shell_lookup():
|
def shell_lookup():
|
||||||
"""Find an appropriate shell for the user"""
|
"""Find an appropriate shell for the user"""
|
||||||
shells = [os.getenv('SHELL'), pwd.getpwuid(os.getuid())[6], 'bash',
|
try:
|
||||||
|
usershell = pwd.getpwuid(os.getuid())[6]
|
||||||
|
except KeyError:
|
||||||
|
usershell = None
|
||||||
|
shells = [os.getenv('SHELL'), usershell, 'bash',
|
||||||
'zsh', 'tcsh', 'ksh', 'csh', 'sh']
|
'zsh', 'tcsh', 'ksh', 'csh', 'sh']
|
||||||
|
|
||||||
for shell in shells:
|
for shell in shells:
|
||||||
|
|
Loading…
Reference in New Issue