Skip to content

Consolidate process cwd() "null" return value across all platforms #2238

@giampaolo

Description

@giampaolo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions