Preferring PWD environment variable over os.getcwd #3248
rbhanot4739
started this conversation in
General
Replies: 2 comments
-
This is to ensure USR2/HUP works consistently. Here is the patch it is refefering: 652f8d2 |
Beta Was this translation helpful? Give feedback.
0 replies
-
@benoitc .. but simply using (and continue using, on re-exec) the directory provided/inherited (or explicitly overridden) on launch seems like the most obviously consistent behavior already. What makes deviating from that desirable, even in the USR2/HUP scenario? (Was this also motivated by some setup involving symlinks? see #3237) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Everyone,
This is my first post on this forum and since it is more of a curiosity question rather than a production blocker for me that's why I am posting this under the General category. If you think this post isn't in the correct place please feel free to move it to the appropriate category and forgive my naiveness.
So I was looking at the
getcwd
function defined in theutils.py
hereJust curious to know why
os.environ['PWD']
is being preferred here ? Sinceos.getcwd()
will directly fetch the current working directory from the OS it will always give the correct directory even if the current directory has been changed, and hence will be more shell and OS agnostic. Further the function anyways fallback toos.getcwd
in casePWD
does not match with the directory given byos.getcwd
or ifPWD
does not even exist.So, what is the reason for using
PWD
not directly rely onos.getcwd
?Beta Was this translation helpful? Give feedback.
All reactions