Skip to content

Commit 80c8ed7

Browse files
committed
Document why an empty PATH entry is kept as the current directory
1 parent 2e066b7 commit 80c8ed7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎cmd2/utils.py‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ def _get_path_dirs() -> set[str]:
382382
The entries are returned as they are written. Resolving them would avoid searching a directory twice
383383
when it is listed under two names, but doing so can raise an exception for an entry which can't be reached.
384384
385+
An empty entry is kept because a POSIX shell searches the current working directory for one. A PATH which
386+
is set to an empty string is a single empty entry, so it is not the same as a PATH which is not set.
387+
385388
:return: the directories, which is an empty set if PATH is not set
386389
"""
387390
env_path = os.getenv("PATH")

0 commit comments

Comments
 (0)