Update $PWD in environment for base.command processes #114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When commands are executed via the
base.command
task, they generally inherit the environment from these
process. Sincese
is a Python script, some things work differently compared to shell scripts. One such thing is that$PWD
is not updated whenbase.command
is run with thecwd
argument, i.e. when the current working directory is changed. This is because Python does not behave like bash or other shells andsubprocess.Popen
is not updating$PWD
! Or seen the other way around,$PWD
is a shell environment variable andsubprocess
does not fiddle with it (see, for example, here).However, the
base.command
task it is often used to run shell scripts and therefore it is expected that$PWD
is updated as it would in a shell. Thus, updating$PWD
should be implemented inbase.command
.