Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The venv pex script handles entrypoint functions differently from PEX. #1241

Closed
jsirois opened this issue Feb 19, 2021 · 0 comments · Fixed by #1242
Closed

The venv pex script handles entrypoint functions differently from PEX. #1241

jsirois opened this issue Feb 19, 2021 · 0 comments · Fixed by #1242
Assignees

Comments

@jsirois
Copy link
Member

jsirois commented Feb 19, 2021

Currently PEX uses the return value of the entry point function:
https://github.com/pantsbuild/pex/blob/2df133378a4f9e8bb3c6966d824465e57c66ba72/pex/pex.py#L476-L479
https://github.com/pantsbuild/pex/blob/2df133378a4f9e8bb3c6966d824465e57c66ba72/pex/pex.py#L645-L651

Which was introduced here:
eac0233#diff-07a90ebaf117fe2a7d1010d8dbe6ed42fab40761f07622b3dba999b2e2dbce78R349-R351

And the pex venv script does not:
https://github.com/pantsbuild/pex/blob/2df133378a4f9e8bb3c6966d824465e57c66ba72/pex/tools/commands/venv.py#L236-L248

After consideration it seems sticking with the change in #605 and bringing the pex venv script in line with the PEX behavior is the best way forward. Existing users expecting this behavior won't be broken this way and the surprisingly (to me) flexible behavior of sys.exit makes this work like you want in most imaginable scenarios (clearly by design on the part of stdlib authors). The behavior though should be better documented.

@jsirois jsirois self-assigned this Feb 19, 2021
@jsirois jsirois mentioned this issue Feb 19, 2021
6 tasks
jsirois added a commit to jsirois/pex that referenced this issue Feb 19, 2021
Previously behavior diverged for entrypoint functions returning a value.
Now both PEXes and the `pex` venv script behave the same and the
behavior is documented and tested.

Fixes pex-tool#1241
jsirois added a commit that referenced this issue Feb 19, 2021
Previously behavior diverged for entrypoint functions returning a value.
Now both PEXes and the `pex` venv script behave the same and the
behavior is documented and tested.

Fixes #1241
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant