There are cases where Process.cwd() cannot be determined, but not due a permission error (AccessDenied). Sometimes the kernel simply returns a "null" information and there's nothing we can do about it. Some other times like in #2237 the kernel returns ENOENT because perhaps the directory no longer exists, and again, we're forced to return a "null" value (this time I opted for None).
When such cases occur, psutil sometimes returns None, some other times an empty string. Perhaps even worse, none of this is documented. Such cases should be consolidated (either return None or empty string everywhere) and documented.
Because the native type returned cwd() is a string, I'm more keen on returning an empty string everywhere rather than None.
There are cases where
Process.cwd()cannot be determined, but not due a permission error (AccessDenied). Sometimes the kernel simply returns a "null" information and there's nothing we can do about it. Some other times like in #2237 the kernel returns ENOENT because perhaps the directory no longer exists, and again, we're forced to return a "null" value (this time I opted forNone).When such cases occur, psutil sometimes returns
None, some other times an empty string. Perhaps even worse, none of this is documented. Such cases should be consolidated (either returnNoneor empty string everywhere) and documented.Because the native type returned
cwd()is a string, I'm more keen on returning an empty string everywhere rather thanNone.