Sample Header Ad - 728x90

How to get the final current working directory of a child process?

1 vote
0 answers
210 views
If I spawn off a child process, I can access its working directory (in a not-very-cross-platform way) any time while it's alive by examining /proc//cwd. But what are my options if I want to know its final location on exit? I've tried watching /proc// after death, but the directory vanishes as soon as the child does, even if the parent's camped out there. And this may not even be a concern, but that seems a bit fragile if my child manages to exit before I can grab its PID and read the symlink.
Asked by Different55 (111 rep)
Feb 1, 2023, 01:05 AM