Commit 2193536e authored by Brian Curtin's avatar Brian Curtin

Fix #15148. Make the shutil.which docstring more thorough

parent dbbc0c8b
...@@ -973,7 +973,9 @@ def get_terminal_size(fallback=(80, 24)): ...@@ -973,7 +973,9 @@ def get_terminal_size(fallback=(80, 24)):
def which(cmd, mode=os.F_OK | os.X_OK, path=None): def which(cmd, mode=os.F_OK | os.X_OK, path=None):
"""Given a command, mode, and a path string, return the path which """Given a command, mode, and a path string, return the path which
conforms to the given mode on the path.""" conforms to the given mode on the PATH, or None if there is no such file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of
os.environ.get("PATH"), or can be overridden with a custom search path."""
# Check that a given file can be accessed with the correct mode. # Check that a given file can be accessed with the correct mode.
# Additionally check that `file` is not a directory, as on Windows # Additionally check that `file` is not a directory, as on Windows
# directories pass the os.access check. # directories pass the os.access check.
......
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