fix util.which if PATH is not in environment
This fixes a test case that failed because PATH was unset in the os.environ.
This commit is contained in:
@@ -1850,7 +1850,7 @@ def which(program):
|
|||||||
if is_exe(program):
|
if is_exe(program):
|
||||||
return program
|
return program
|
||||||
else:
|
else:
|
||||||
for path in os.environ["PATH"].split(os.pathsep):
|
for path in os.environ.get("PATH", "").split(os.pathsep):
|
||||||
path = path.strip('"')
|
path = path.strip('"')
|
||||||
exe_file = os.path.join(path, program)
|
exe_file = os.path.join(path, program)
|
||||||
if is_exe(exe_file):
|
if is_exe(exe_file):
|
||||||
|
|||||||
Reference in New Issue
Block a user