Skip to content

python: exit with the exit code returned by main_function - #116

Merged
lf- merged 1 commit into
mercury-headfrom
jade/push-nytwtmqvyomo
Nov 26, 2026
Merged

lf- merged 1 commit into
mercury-headfrom
jade/push-nytwtmqvyomo

Conversation

@lf-

@lf- lf- commented Nov 24, 2026

Copy link
Copy Markdown

my agent and I got really surprised by main_function not working like
[project.scripts] in pyproject.toml. we assumed that the program would
exit with the return code of the declared main function, however, it is
instead surprisingly eaten.

upstream-pr: meta#1644

@lf-
lf- requested review from a team, csamak and dtpowl November 24, 2026 00:08
@hdgarrood

Copy link
Copy Markdown

This seems reasonable to me, but until this gets merged upstream I feel like it might be safer to work around this by throwing instead of returning something nonzero from that function?

@lf-

lf- commented Nov 24, 2026

Copy link
Copy Markdown
Author

This seems reasonable to me, but until this gets merged upstream I feel like it might be safer to work around this by throwing instead of returning something nonzero from that function?

yea we did! i'm sympathetic to avoiding having a downstream merge of this though. i just think we're going to get footgunned by it again.

@hdgarrood hdgarrood left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah okay, point taken

my agent and I got really surprised by main_function not working like
[project.scripts] in pyproject.toml. we assumed that the program would
exit with the return code of the declared main function, however, it is
instead surprisingly eaten.

upstream-pr: meta#1644
@lf-
lf- force-pushed the jade/push-nytwtmqvyomo branch from 51f43ac to 9b05a7c Compare November 26, 2026 20:35
@lf-
lf- merged commit 3325bd8 into mercury-head Nov 26, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants