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:
Scott Moser
2014-01-23 16:48:12 -05:00
parent 0a6cd7f0b6
commit 144fb6fe7d

View File

@@ -1850,7 +1850,7 @@ def which(program):
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
for path in os.environ.get("PATH", "").split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):