uwefladrich / scriptengine

A lightweight and extensible framework for execution scripts written in YAML.
GNU General Public License v3.0
15 stars 4 forks source link

Update $PWD in environment for base.command processes #114

Closed uwefladrich closed 2 weeks ago

uwefladrich commented 6 months ago

When commands are executed via the base.command task, they generally inherit the environment from the se process. Since se is a Python script, some things work differently compared to shell scripts. One such thing is that $PWD is not updated when base.command is run with the cwd argument, i.e. when the current working directory is changed. This is because Python does not behave like bash or other shells and subprocess.Popen is not updating $PWD! Or seen the other way around, $PWD is a shell environment variable and subprocess 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 in base.command.