Skip to content

Commit

Permalink
Add support for macos with its fork interesting things
Browse files Browse the repository at this point in the history
  • Loading branch information
ntoskernel committed Apr 27, 2023
1 parent 910d45f commit a5759d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions deepsecrets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
import platform

MODULE_NAME = 'deepsecrets'

Expand All @@ -25,3 +26,5 @@ def set_logging_level(level: int) -> None:

PROFILER_ON = False
BASE_DIR = os.getcwd()

PLATFORM = platform.system()
8 changes: 6 additions & 2 deletions deepsecrets/core/modes/iscan_mode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from multiprocessing import get_context
import os
from abc import abstractmethod, abstractstaticmethod
from datetime import datetime
Expand All @@ -8,7 +9,7 @@

from dotwiz import DotWiz

from deepsecrets import PROFILER_ON, logger
from deepsecrets import PLATFORM, PROFILER_ON, logger
from deepsecrets.config import Config
from deepsecrets.core.model.finding import Finding, FindingMerger
from deepsecrets.core.model.rules.exlcuded_path import ExcludePathRule
Expand All @@ -27,7 +28,10 @@ class ScanMode:

def __init__(self, config: Config, pool_engine: Optional[Any] = None) -> None:
if pool_engine is None:
self.pool_engine = Pool
if PLATFORM == 'Darwin':
self.pool_engine = get_context('fork').Pool
else:
self.pool_engine = Pool
else:
self.pool_engine = pool_engine

Expand Down

0 comments on commit a5759d4

Please sign in to comment.