I noticed that `./pants run ...` and `[subprocess-...
# general
b
I noticed that
./pants run ...
and
[subprocess-environment]
interact in inconsistent ways, is this intentional/expected? https://gist.github.com/huonw/3e6ebe4c9a4037a31655fce34eea357d 1.
./pants run ./main.py
(running a python source directly) sets the env vars from
[subprocess-environment]
2.
./pants run //:pex
(running a
pex_binary
) does not set the env vars
f
I can repro this behavior. My understanding is that this is expected. Running a
pex_binary
is equivalent to producing a package package of the
pex_binary
target and then having it executed from the repository root. The
[subprocess-environment]
set "environment settings for forked subprocesses", so once the PEX binary is produced, it must be detaching from the initial process so the env vars you've set no longer apply. Please see https://www.pantsbuild.org/docs/python-run-goal#execution-semantics for more information. Do your workflows depend on the env vars propagated to the
pex_binary
targets, i.e. you cannot run the `python_source`s?
b
Makes sense; we can run the
python_sources
, just they're also packaged into
pex_binary
for other reasons, so it'd be 'cute' if we could reuse them. Not a problem though. Thanks
🙌 1