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

Abort program if either background task fails #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Spindel
Copy link
Owner

@Spindel Spindel commented Feb 9, 2022

This uses select! instead of a try-join that would let background
threads fail and the program continue anyhow.

This was easiest to notice if the socket was already bound, as the
exporter would keep running even as it was unable to serve any data.

Now instead it properly fails and terminates cleanly, although maybe not
signalling failure exit code.

Because I had forgotten previously, this reformats the code with no
other changes.
I didn't want to pull in a big parser, so we just use the commandline
and parse like that, falling back to previous behavoiur.
This uses select!  instead of a try-join that would let background
threads fail and the program continue anyhow.

This was easiest to notice if the socket was already bound, as the
exporter would keep running even as it was unable to serve any data.

Now instead it properly fails and terminates cleanly, although maybe not
signalling failure exit code.
@Spindel Spindel force-pushed the fail-properly-on-errors branch from 034044d to 8819dad Compare February 9, 2022 20:41
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.

1 participant