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

Implement exit statuses #1008

Closed
wants to merge 1 commit into from
Closed

Implement exit statuses #1008

wants to merge 1 commit into from

Conversation

ream88
Copy link
Contributor

@ream88 ream88 commented Jan 4, 2024

Thanks for merging 92b48e4, however I just found another small thing we could improve. Currently the mix tasks included in hex do all exit with code 0, even when an error occurred. This PR changes this to 1 which helps with scripts for example on GitHub CI.

@wojtekmach
Copy link
Member

we have a set_exit_code utility function:

% rg set_exit_code
lib/mix/tasks/hex.repo.ex
230:        Mix.Tasks.Hex.set_exit_code(1)
235:        Mix.Tasks.Hex.set_exit_code(1)

lib/mix/tasks/hex.ex
420:    def set_exit_code(code), do: throw({:exit_code, code})
423:    def set_exit_code(code), do: System.at_exit(fn _ -> System.halt(code) end)

lib/mix/tasks/hex.publish.ex
104:              _ -> Mix.Tasks.Hex.set_exit_code(1)
157:            Mix.Tasks.Hex.set_exit_code(1)

lib/mix/tasks/hex.audit.ex
42:        Mix.Tasks.Hex.set_exit_code(1)

lib/mix/tasks/hex.info.ex
80:        Mix.Tasks.Hex.set_exit_code(1)
85:        Mix.Tasks.Hex.set_exit_code(1)
98:        Mix.Tasks.Hex.set_exit_code(1)
103:        Mix.Tasks.Hex.set_exit_code(1)

lib/mix/tasks/hex.outdated.ex
130:    if outdated?, do: Mix.Tasks.Hex.set_exit_code(1)
196:          Mix.Tasks.Hex.set_exit_code(1)
202:          Mix.Tasks.Hex.set_exit_code(1)

lib/mix/tasks/hex.package.ex
253:      Mix.Tasks.Hex.set_exit_code(code)
266:      Mix.Tasks.Hex.set_exit_code(code)

if it's not used on the task you worked on, could you send another PR using that utility? Thanks!

@wojtekmach wojtekmach closed this Jan 4, 2024
@ream88
Copy link
Contributor Author

ream88 commented Jan 4, 2024

Ah sorry, I did not check the other tasks. Yep will create a new PR.

@ream88 ream88 deleted the exit-status branch January 4, 2024 12:49
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