Ensure non-zero exit code when startup fails #1278
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR proposes that running uvicorn without
--workers
and--reload
at startup failure will exit with code 3.The reasoning for the number 3 is to differentiate from the general exit code, and to match gunicorn's decision (consensus).
What about
--workers
and--reload
?Well, using
--workers
you actually don't exit at startup failure yet. See #1115As for the
--reload
, what do you recommend @euri10 ?server.started
is alwaysFalse
on themain.run()
becausetarget=server.run
runs in another process. Until #1177 (not released yet), on startup failure it didn't exit as well.