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

fix(internals): Drop default factories at exit #13

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

johnchildren
Copy link
Collaborator

Up till now the static default factories provided by this crate would not be dropped on program exit, which would leak temporary directories into the user's file system. This commit fixes that bug by wrapping the factories in a mutex and an option and explicitly dropping them at program exit via use of ctor.

Tests that tested this broken behavior have been removed, though we probably need some documentation to make users aware of the proper usage of static factories if they require more than one in their program.

Up till now the static default factories provided by this crate would
not be dropped on program exit, which would leak temporary directories
into the user's file system. This commit fixes that bug by wrapping the
factories in a mutex and an option and explicitly dropping them at
program exit via use of `ctor`.

Tests that tested this broken behavior have been removed, though we
probably need some documentation to make users aware of the proper usage
of static factories if they require more than one in their program.
.ok()
.flatten()
.map(|u| (u.uid, u.gid))
.expect("no user `postgres` found is system")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Suggested change
.expect("no user `postgres` found is system")
.expect("no user `postgres` found in system")

Probably also want to factor this out into a new function

@johnchildren johnchildren merged commit 30752d1 into master Dec 4, 2023
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