Skip to content

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

Merged
johnchildren merged 1 commit intomasterfrom
bugfix/leaking-files-from-no-static-drop
Dec 4, 2023
Merged

fix(internals): Drop default factories at exit#13
johnchildren merged 1 commit intomasterfrom
bugfix/leaking-files-from-no-static-drop

Conversation

@johnchildren
Copy link
Copy Markdown
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.
Comment thread src/asynchronous.rs
.ok()
.flatten()
.map(|u| (u.uid, u.gid))
.expect("no user `postgres` found is system")
Copy link
Copy Markdown
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