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

Bug Fix: Plugins Fail To Load on Python 3.8+ #505

Merged
merged 2 commits into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion detect_secrets/core/secrets_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

from . import scan
from .potential_secret import PotentialSecret
from detect_secrets.settings import configure_settings_from_baseline
from detect_secrets.settings import get_settings


class PatchedFile:
Expand Down Expand Up @@ -55,7 +57,13 @@ def scan_files(self, *filenames: str, num_processors: Optional[int] = None) -> N
if not num_processors:
num_processors = mp.cpu_count()

with mp.Pool(processes=num_processors) as p:
child_process_settings = get_settings().json()

with mp.Pool(
processes=num_processors,
initializer=configure_settings_from_baseline,
initargs=(child_process_settings,),
) as p:
for secrets in p.imap_unordered(
_scan_file_and_serialize,
[os.path.join(self.root, filename) for filename in filenames],
Expand Down