Skip to content

🐛main operation was failing without explicit exit.#722

Merged
cowboyd merged 1 commit intov3from
cl/main-implicit-exit
Jul 10, 2023
Merged

🐛main operation was failing without explicit exit.#722
cowboyd merged 1 commit intov3from
cl/main-implicit-exit

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented Jul 7, 2023

Motivation

main() only works correctly whenever you call yield* exit() or if there was a error, because it relies on resolving a containing action (the entire main method is just one big action).

However, if your operation completes successfully and you don't invoke the exit operation, then it fails because the main action never resolves. This was because we were returning early from the action.

Approach

This removes the return statement and places the implicit exit into a more prominent location so that we are always guaranteed to resolve ith an exit status no matter what.

@cowboyd cowboyd requested a review from neurosnap July 7, 2023 13:03
`main()` only works correctly whenever you call `yield* exit()` or
if there was a error, because it relies on resolving a containing
action (the entire main method is just one big action).

However, if your operation completes successfully and you _don't_
invoke the exit operation, then it fails because the main action never
resolves. This was because we were returning early from the action.

This removes the return statement and places the implicit exit into a
more prominent location so that we are always guaranteed to resolve
ith an exit status no matter what.
@cowboyd cowboyd force-pushed the cl/main-implicit-exit branch from 05f4ad0 to ccd0e5e Compare July 7, 2023 13:04
@cowboyd cowboyd merged commit e3483b7 into v3 Jul 10, 2023
@cowboyd cowboyd deleted the cl/main-implicit-exit branch July 10, 2023 07:22
taras pushed a commit that referenced this pull request Nov 12, 2025
🐛main operation was failing without explicit exit.
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