Commit be4c6e5a authored by Guido van Rossum's avatar Guido van Rossum

which(): absolutize path if necessary.

parent 0de4b00b
...@@ -143,6 +143,8 @@ def which(program): ...@@ -143,6 +143,8 @@ def which(program):
for dir in binpath: for dir in binpath:
path = os.path.join(dir, program) path = os.path.join(dir, program)
if os.path.isfile(path) and os.access(path, os.X_OK): if os.path.isfile(path) and os.access(path, os.X_OK):
if not os.path.isabs(path):
path = os.path.abspath(path)
return path return path
raise IOError, "can't find %r on path %r" % (program, strpath) raise IOError, "can't find %r on path %r" % (program, strpath)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment