On Wed, Sep 15, 2021 at 08:53:21PM +1000, Chris Angelico wrote:
Sometimes there is no valid path to something,
I don't understand what you mean by that. If there is no valid path to something, where exactly are you cd'ing to, and how does it help you with the thing that has no valid path to it?
or you need to be immune to directory renames. The normal solution would be to use openat() etc (or, in Python, os.open() with a dir_fd). I'm not sure what happens on Windows.
Normal for whom? Let's not forget that there are still a bazillion people who write scripts in bash or some other shell, or Python, that just do the simplest thing that can possibly work. Namely cd into the directory they want to be in. This is a legitimate use-case. Not everyone needs to care about threads.
Additional wrinkle: Can this be made asyncio compatible? Is it possible to make it, instead of thread-local, aware in some way of which task it's running?
Are you suggesting that you might want to run multiple async coroutines in different working directories? I think that designing this for threads or async is over-engineering. -- Steve