richard.schneeman / gmail.com wrote:
> It's come to my attention that this is fairly hardcoded into the OS
> (changing CWD is a per-process operation rather than a per-thread
> one). I do not have a proposed implementation for how to change
> directory within a thread, perhaps we could take ideas from another
> language allows this functionality if there are any.

Right, this is one of the reasons the *at family of syscalls
(openat, renameat, etc...) was introduced into POSIX.

Adding support for those might be good idea.  However, OS support
outside Linux/Solaris is probably still limited at the moment.

Linux also allows unsetting the CLONE_FS flag for cloned threads,
but that's completely unportable.